The form submits when I click the submit button on the form. But the
addDoc
function doesn't fire. Not even when I simply reduced it to "alert('hello
world)." What I don't know is what data is coming back from the server
and
if there's a problem. If there is no problem from the server, why isn't
my
success function firing.
I could be wrong but I thought that ajaxSubmit was required to submit the
form via ajax. I think the form will submit anyway, thus your file is
uploaded, because you are not stopping the default form submission action.
Generally you want to do something like this:
$("form").submit(function() {
$(this).ajaxSubmit( // params here // );
return false; // stop default submit action;
});
-- Josh
----- Original Message -----
From: "Shelane Enos" <[EMAIL PROTECTED]>
To: <jquery-en@googlegroups.com>
Sent: Friday, February 15, 2008 11:27 AM
Subject: [jQuery] Re: ajax form plugin question
The form submits when I click the submit button on the form. But the
addDoc
function doesn't fire. Not even when I simply reduced it to "alert('hello
world)." What I don't know is what data is coming back from the server
and
if there's a problem. If there is no problem from the server, why isn't
my
success function firing.
The reason I know the submit is working is that when I reload the page I
see
the item listed (as it should be).
On 2/15/08 11:22 AM, "Josh Nathanson" <[EMAIL PROTECTED]> wrote:
I think you need to use the ajaxSubmit method rather than (or in addition
to) the ajaxForm method. ajaxForm just "preps" the form AFAIK.
-- Josh
----- Original Message -----
From: "Shelane" <[EMAIL PROTECTED]>
To: "jQuery (English)" <jquery-en@googlegroups.com>
Sent: Friday, February 15, 2008 11:17 AM
Subject: [jQuery] ajax form plugin question
When a form is submitted - specifically with a file upload - with the
ajax form plugin, firebug doesn't show a submission, nor any return.
This is making it difficult to debug, hince the question. I know that
my files are being uploaded, but the success function doesn't seem to
be running:
addDoc = function(data){
$('#docform').resetForm();
$('#formmodal').jqmHide();
alert(data);
stripe('#documents');
removeDoc('#row' + doc);
}
fileValidate = function(formData){
if(!document.docform.attachment.value)
return false;
else
alert('about to submit');
}
$('#docform').ajaxForm({success: addDoc, beforeSubmit: fileValidate,
dataType: 'json'});
Am I missing something.