Hi, I have made a basic test case with a few text inputs and it works perfect with just them.
However if I add a file input to them the json object is sent to the browser as a file download and the success method is never hit. Anyone figure this out? I know the code that returns the json object is absolutely fine, it works perfect without the upload input. I'll show you my code with the file upload: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title> Home Page </title> <script type="text/javascript" src="/Content/Scripts/ jquery-1.2.6.min.js"></script> <script type="text/javascript" src="/Content/Scripts/ jquery.form.js"></script> <script type="text/javascript"> // prepare the form when the DOM is ready $(document).ready(function() { var options = { iframe: true, // force iframe, since I'm using json target: '#hiddenText', // target needed? success: processJson, // post-submit callback url: '/Home/GetJsonObject/', // form action type: 'json' // json type }; // bind to the form's submit event $('#ajaxForm').submit(function() { // inside event callbacks 'this' is the DOM element so we first // wrap it in a jQuery object and then invoke ajaxSubmit $(this).ajaxSubmit(options); // always return false to prevent standard browser submit and page navigation return false; }); }); function showRequest(formData, jqForm, options) { return true; } // post-submit callback function processJson(data) { //eval the json object var jsonObject = eval('(' + data + ')'); var message = jsonObject.message; var title = jsonObject.heading; $('#title').html(title); $('#message').html(message); } </script> </head> <body> <h2 id="title">Title</h2> <p id="message">Message</p> <fieldset> <legend>Form lulz</legend> <form id="ajaxForm" action="/Home/Index" method="post" enctype="multipart/form-data"> <label for="titleInput">Title:</label><br /> <input type="text" id="titleInput" name="titleInput" /><br /> <label for="messageInput">Message:</label><br /> <input type="text" id="messageInput" name="messageInput" / ><br /> <label for="imageUpload">Image Upload:</label><br /> <input type="file" id="imageUpload" name="imageUpload" /><br / ><br /> <input type="submit" id="submitButton" name="submitButton" value="Change Page ยป" /><br /> </form> <textarea cols="30" rows="5" id="hiddenText" style=""></ textarea> </fieldset> </body> </html>