I have a JSP page which is populated with some textures and the submit button that makes an AJAX GET request. Users can type in any text. I am having problems when the user enters the string with double quoted string or backslash. I am currently using encoded RIMPonent and JSON.stringify so that the request URL parameters can be prepared. Is this the proper way? The backend code is getting an improper Jason object. Here is a sample
User type: js code: However, my server receives the message I am currently using encodeuric components and JSON.stringify < / Blockquote> This is your problem. Since you do not want to add values to any URL, you should not call If you include Jasonson in the URL, you will need to call In summary You need to avoid right at the right time. Test "cases" good in txtArea0
var txtData0 = Encoderic Silence ($ ('# txtArea0'). Val ()); Var txtData1 = encodeurIComponent ($ ('# txtArea1'). Val ()); Var msg = JSON.stringify ([{"id": 0, "txtData": txtData0}, ...]);
"[{id": 0, "txtData": msg "msg" receives "" good "}, ... ] " I do not completely know why this is happening.
You can actually survive only when you are actually making strings in that format. encodercontact .
EncoderIconconverter , but no one else.
Escape methods are not a magic sauce that your code works.
No comments:
Post a Comment