Submit Ubercart Form Using Ajax
I'm working on a module where I ajaxify the whole checkout process for the user. What I'm having trouble with i开发者_JS百科s when the user clicks the "review Order" button, I need to submit the order, validate, and then give him the order review page with ajax, and then when he confirms order, i can finally reload.
I can't figure out how to process the thing using ajax. Can someone please help?$.post is all you need Example:
$.post("order.php", { name: "John", cart: "id1,id2,id3" }, function(data){ alert("Data Loaded: " + data); });
In the php file you can make a explode function and work out with the ids
say you have a , so in jquery you do: $.
("#myform).submit(function(){
if("#email").val() !== ""){
AJAX FUNCTION GOES HERE // only will happen if email field is not null
} else {
return false; // this ensures the form is not posted in the traditional way
}
精彩评论