The sample provided isnt clear at all
On 24 abr, 10:09, Donny Kurnia <donnykur...@gmail.com> wrote: > 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 > > thatfilefields don't work. So I use $(form).ajaxSubmitand 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. > > Fileupload 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 Kurniahttp://hantulab.blogspot.comhttp://www.plurk.com/user/donnykurnia