I am using jquery ajax api to submit (POST/GET) a text as parameter to a processing page.
<input type="text" id="txtboxdata" name="txtboxdata" >
var dataString = "tmpVar="+ escape( $("#txtboxdata").val() );
$.ajax({ type: "POST",
url: "processing.jsp",
data: dataString ,
dataType: "json",
success: function(){}
});
//dataString holds the parameter and value to be passed. Value is retrieved from a text box.
If the text box
- contains UTF-8 characters
and - apply the javascript "escape" on the text box value
then the parameter tmpVar goes disappears from the request object in the processing page(processing.jsp).
I used the debugger, and checked the request object. The parameter called "tmpVar" never shows up.
This works correctly when the following conditions are met
tmpVar shows up in the request object of processing.jsp when
- there are no UTF-8 characters.
- I do not apply "escape" before making the ajax call.
My Question I would like to understand why does applying escape on a text containing UTF-8 not show up in the request object?
PS: I used "form serialize()" to solve the problem, just trying to understand why the issue occured.
Firebug: looks fine, this always shows up correctly. No missing data before the actual POST/GET.
tmpVarvariable not being seen? Use Firebug or Chrome to capture these and post them