I am having problems with the return data from the jquery form plugin
when one of the values contains html. I am not sure if this is a
jquery issue or a for plugin issue.

My javascript looks like this:

        var uploadOptions = {
                dataType:       'json',
            url:                '/uploads/upload.json',
            success:    addUpload
        };
        $("input[name='upload']").click(function() {
                $(this).parents("form:first").ajaxSubmit( uploadOptions );
        return false;
        });

The response data that is generated is:
{"status":"success","validationErrors":null,"newUpload":"\n\t<br><img
src='http:\/\/www.google.ca\/intl\/en_ca\/images\/logo.gif'>"}

What happens is the data from the response seems to get automatically
inserted into the DOM rather than passed to the addUpload function.
The addUpload function is not being called at all unless... I change
the response data to:
{"status":"success","validationErrors":null,"newUpload":"\n\tNot
Html"}

At which point the addUpload call back is called with the data json
object passed.

The response headers of the data with the HTML are the same as without
the html:
Response Headers
Date    Mon, 17 Aug 2009 20:38:38 GMT
Server  Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8j DAV/2 PHP/
5.2.9
X-Powered-By    PHP/5.2.9
P3P     CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
Content-Length  134
Keep-Alive      timeout=5, max=100
Connection      Keep-Alive
Content-Type    text/html


Reply via email to