evibesmusic
asked on
Post file via the $.post() jquery method
Experts,
I am trying to POST form data (several text fields and a file) via AJAX using the following code:
Can someone help me update my code so that it posts the File field that I have in my form?
Cheers!
I am trying to POST form data (several text fields and a file) via AJAX using the following code:
//POST FORM DATA AND SHOW SUCCESS MESSAGE
$.post("save.php?submit",
$("#new_request_form").serialize()).done(
//ALERT USER THAT PROJECT HAS BEEN SAVED
function(){
alert('Your request has been submitted for consideration.\n\nPlease check your Lotus Notes inbox for a copy of your submission.\n\nPress "OK" to continue.');
},//END FUNCTION
//REDIRECT
function(){
document.location.href = "demo.php";
}//END FUCTION
);
All of my form data posts correctly except the File field. I've read that this may have to do with the serialization of the data as it is being passed.Can someone help me update my code so that it posts the File field that I have in my form?
Cheers!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I will change methods as per both suggestions.