I have no idea what's wrong with my code to call another PHP file via jQuery.ajax function. Need some help in identifying the error.
$('#submit').click(function(event){
event.preventDefault();
do_cart();
});
function do_cart(){
alert('testing');
$.ajax({
url:'doCartupdate.php',
success:function(){
alert('Success.');
$('#form').submit();
}
});
}
Do I miss anything here? I have no need to pass data over to the PHP file, I just need the function inside the PHP file get called.
edit 2: now I required some alert boxes.
<script type ="text/javascript">
$('#submit').live('click',function(event){
//event.preventDefault();
do_cart();
alert('Ridirecting to paypal');
});
function do_cart(){
alert('please wait');
$.ajax({
url:'doCartupdate.php',
success:function(){
alert('Success.');
//$('#form').submit();
}
});
}
</script>
It would be good if I can reduce the box to only 1 or none.