[jQuery] Getting response from dataType: Script

[jQuery] Getting response from dataType: Script

<span style="font-family: trebuchet ms,sans-serif;">A co-worker is new to jQuery and has a question over my head. :)  See below.</span><br style="font-family: trebuchet ms,sans-serif;"><br style="font-family: trebuchet ms,sans-serif;">
<span style="font-family: trebuchet ms,sans-serif;">Glen</span><br style="font-family: trebuchet ms,sans-serif;"><span style="font-family: trebuchet ms,sans-serif;">---</span><br style="font-family: trebuchet ms,sans-serif;">
<span style="font-family: trebuchet ms,sans-serif;">Is it possible to get response data from $.ajax when using the dataType: 'script' ?</span><br style="font-family: trebuchet ms,sans-serif;"><br style="font-family: trebuchet ms,sans-serif;">
<span style="font-family: trebuchet ms,sans-serif;">I need to use dataType 'script' in order to avoid cross-site scripting issues and it works well, but I need to be able to pass back JSON data from the server-side and get to it in the ajax success handler.  I don't see any data getting passed to the success handler for this case.
</span><br style="font-family: trebuchet ms,sans-serif;"><br style="font-family: trebuchet ms,sans-serif;"><span style="font-family: trebuchet ms,sans-serif;">As a separate test, I tried dataType: 'json' and my success handler is called with data decoded from my json response data and textStatus='success'.  Unfortunately, I don't think I can use 'json' for my real solution as I mentioned 'script' avoid XSS issues.
</span><br style="font-family: trebuchet ms,sans-serif;"><br style="font-family: trebuchet ms,sans-serif;"><span style="font-family: trebuchet ms,sans-serif;">Thanks for any help on this.</span><br style="font-family: trebuchet ms,sans-serif;">
<br style="font-family: trebuchet ms,sans-serif;"><p style="font-family: trebuchet ms,sans-serif;" class="MsoNormal"><span style="font-size: 10pt;"></span>






    • Topic Participants

    • glen