Aha, but won't work so well with JSON response, right? I do check XHR in my PHP script and I thought it would work doing something like this:
$xhr=$_SERVER['HTTP_X_REQUESTED_WITH']=='XMLHttpRequest'; if(!$xhr) { print("<textarea>".$json."</textarea>"); } else { print($json); } That way I thought that if I choose to upload a file it would use the ! $xhr alternative and if I just edit eg image title, the other. On Apr 9, 12:39 pm, Mike Alsup <mal...@gmail.com> wrote: > > I have a image edit form where the user can upload a new image and/or > > edit image information such as title, description etc. Since I use the > > jQuery Forms plugin for most of my other forms I wanted to use it here > > as well, but last night I encountered a little problem... > > > I use JSON for the return data, and yes I do use the textbox method. > > It works fine as long as I upload a new image, but if I skip that and > > just edit some of the other fields such as title etc, the destination > > php script runs ok, but the returned JSON data seems to be ignored > > somehow (it is there, but is just not passed on to my javascript > > "success function"). > > > Do I have to make a separate form for uploading the image file and > > another one for editing the other data? > > > /Mattias > > If you don't want to detect the XHR on the server, you can tell the > form plugin to behave the same way regardless of whether a file is > being uploaded or not. You do this by setting the 'iframe' option to > true. > > Mike