jQuery - How to get JSON string rather than HTML result after the form is submitted
<p>I am using XAMPP + WINDOWS to develop my prototype.</p>

<p>I have designed a form that uses jQuery Form Plugin to do the form submission.</p>

<p>When the form doesn't include FILE field, the return value looks like:</p>

<pre><code>{"success":false,"msg":"incorrect-captcha-sol"} which is jason string.
</code></pre>

<p>However, after I add a FILE into the form, I always get sth like</p>

<pre><code>&lt;head&gt;&lt;/head&gt;&lt;body&gt;{"filesize":181,"success":false,"msg":"incorrect-captcha-sol"}&lt;div firebugversion="1.5.4" style="display: none;" id="_firebugConsole"&gt;&lt;/div&gt;&lt;/body&gt;
</code></pre>

<p>I need to get the filesize information from the server so that I can apply validation rule on the uploaded file. Now the return results look mess and is there way that I can get the json string instead?</p>

<p>Thank you</p>

<pre><code>    var options = { &lt;&lt; client script
    target:        '#output',   // target element(s) to be updated with server response 
    beforeSubmit:  showRequest,  // pre-submit callback 
    success:       showResponse,  // post-submit callback 
    url:           'recaptcha.php'  // override for form's 'action' attribute 
}; 
$('#myform').submit(function() { 
    $(this).ajaxSubmit(options); 
    return false; 
});


    $results['success'] = true; &lt;&lt; server script snippet
    $results['msg'] = 'Success, you may proceed!';
    echo json_encode($results);
</code></pre>
