oi_antz wrote:
> I'm trying to ajaxify my application, which requires submitting forms
> via $.post or $(form).ajaxSubmit. Problem I'm having with $.post is
> that file fields don't work. So I use $(form).ajaxSubmit and my
> response text is something like this:
> 
> {
>     '_JS':'/* javascript code to evaluate, contains escaped quotes
> (\") */',
>     '_CONTENT' : '<!-- html code containing escaped quotes and stuff --
>> '
> }
> 
> The callback tries JSON.parse(responseText), but I am finding all my
> \" characters inside data members _JS and _CONTENT have been converted
> to html entities. I guess this is because the jquery form plugin is
> using a custom html element for xhr and firefox converts quotes found
> inside quotes to html entities.
> 
> Is there a way to configure the form plugin to use XMLHttpRequest, or
> another method that doesn't tamper with the responseText?
> 

Are you using malsup's form plugins? In the server side processing, the
json response must wrapped inside <textarea></textarea>. You can see the
the example php page in malsup's site.

File upload didn't submitted via XMLHttpRequest, but via hidden iframe.
That's why you need to wrap it inside <textarea> so jQuery can parse the
response json.

--
Donny Kurnia
http://hantulab.blogspot.com
http://www.plurk.com/user/donnykurnia

Reply via email to