Jquery Form Submission Is Not Working
I try to submit a form after my ajax request done. I do code like following. But when I click the button ajax request is go to and send 200 ok feedback. But after that form not sub
Solution 1:
try to build the $.post
request like:
$.post('cart.php', {email:'email',pkgname:'pkgname'}, funtion(data){
console.log(data);//return the data from server if anything echoed in cart.php file
})
where data
contains what cart.php
returns (i cannot understand why you are sending the form twice anyway)
Solution 2:
I update code as below and I think it is not getting response from sever I think u update this and check you will get your problem :
$('document').ready(function(){
$('#submit').on('click',function(){
$.post('cart.php',{email:'email',pkgname:'pkgname'}).success(function(data){
$('form').submit();
}).error(alert("Code has error"));
});
});
Solution 3:
Here answer for my question. I don't know how is this possible??? :( My submit button id is the cause for my question. You never ever use #submit as a ID. It will be a problem!! This bugger wast my two days!!
So correct code is
<!DOCTYPE html><html><head><metacharset="UTF-8"><title></title><scriptsrc="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script><script>
$('document').ready(function(){
$('#submit1').on('click',function(){
$.post('cart.php',{email:'email',pkgname:'pkgname'}).then(function(){
$('form').submit();
});
});
});
</script></head><body><formaction="cart.php"method="post"><inputtype="button"id="submit1"value="submit" /></form></body></html>
Post a Comment for "Jquery Form Submission Is Not Working"