I'm using jQuery and PHP to post a long dynamically created HTML Form. Since I need to have a "Sending" dialog and show the results on the same page (ideally in a jQuery popup), I do not use the traditional HTML form submit. What I'm doing works great except that File input types do not upload.
Is there a way to do this?
Here is my code:
jQuery:
function submitForm(submiturl)
{
$.blockUI({ message: "<h2>Submitting...</h2>" });
var form = $('#theForm').serialize();
var fields = "<?= urlencode(serialize($allFields)) ?>";
$.ajax({
url: submiturl,
data: {form: form, fields: fields, extraResults: window.extraResults},
type: "post",
cache: false,
complete: function() {
// unblock when remote call returns
$.unblockUI();
},
error: function (xhr, ajaxOptions, thrownError) {
alert("ERROR");
},
success: function( strData ){
alert("SUCCESS: " + strData);
}
});
}