How to Send Special Characters in AJAX Request? - AJAX Views : 2139
Tagged in : AJAX
0 0
Send mail
If you send special characters such as : & % # @ through ajax request,sometimes the value will not received properly by the progarm which process the ajax request.

For example:

When you pass the string which like : 'hiox & india' ,in AJAX request ,the program which process AJAX request will recevice only 'hiox' .

Solution:

The solution for this problem is simply use escape() function of javascript to the string which contain special characters and pass the escaped string in AJAX request,so that the process program will receive the string correctly .


For example:
var aj=new XMLHttpRequest();
var process="process.php";
var name="hiox & india";
name=escape(name);
process=process+"name="+name;
aj.onreadystatechange=ajfun;
aj.open("GET",process,true);
aj.send(null);






By Selva, On - 2008-06-17



    Login to add Comments .