|
|
How to Send Special Characters in AJAX Request? - AJAX
|
Views : 2139
|
|
Tagged in : AJAX
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
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 |
|
|
|