So the problem is:
Doing the form submission to the server through the method ajaxSubmit() plugin mentioned above. Forms without file element work good. The result is returned as a JSON string.
Problems arise when the form is added to the file selection. In form template I have a gun get each enctype. The plugin sends all, the result comes in the right view (looking through firebug). First problem — the browser offers to save the result as a file. Googling, I came to the conclusion that the Content-Type of the response had to change from 'application/json; charset=UTF-8'
default to 'text/html; charset=utf-8'
.
Now the answer comes "Studio", but the success function doesn't work. Apparently, now bung in the format of the expected result — I pointed out the option dataType: 'json'
. Removed the option — success work out, but, apparently, the plugin tries to convert the result to html format, because it adds tags of type HEAD and BODY. And firebug shows that the initial result came true, ie it cant exactly plug-in.
Has anyone met with such problems? How to solve them? Using jQuery 1.4.2 (tried to switch to 1.3.2 — the same rake), and Form 2.5.1 (such as the last version).