tags:

views:

54

answers:

1

I get a script that creates a form with an input file after clicking on a link, but when I load the function creating the form, the success callback is immediatly called. Did you get the same problem ?

Here's my function :

html = $('<div>');
form = $('<form method="post" action="">');
form.append('<input type="file" name="image" value=""> <input type="submit" value="OK">');
html.html('Ajouter une nouvelle image : <br>');
html.append(form);
$(options.area).prepend(html);

ajaxOptions = { iframe : 'true',success: function(res) {  alert(res); }  };
$(options.area).find('form').ajaxSubmit(ajaxOptions);

Thanks for your help !

+1  A: 

The ajaxSubmit does the actual submitting of the form ..

Use the ajaxForm method instead, to initialize the form ..

Gaby
My mistake ! Thanks a lot
Tom