php - Ajax getting cancelled in browser -
when click , run ajax script, see error in chrome:
status: cancelled
the json data returns page in url bar. sql table updating error message indicate above displaying , modal doesn't remain open. suspect there few problems here wonder if notice something.
this ajax script inside php variable why may see escaped characters. here $row
php array. please don't confused.
$("document").ready(function() { $(".form-inline'.$row["userid"].'").submit(function(event) { event.preventdefault; var formdata = new formdata($(".form-inline'.$row["userid"].'")[0]); console.log(); $.ajax({ type: "post", datatype: "json", url: "sponsorship.php", data: formdata, success: function(response) { if (response.success) { $("#mymodal'.$row["userid"].'").modal(\'show\'); $(".form-inline'.$row["userid"].'").hide(); $("#paypalform'.$row["userid"].'").show(); $("#alertmessage'.$row["userid"].'").show(); $("#closebutton'.$row["userid"].'").hide(); } else { console.log("an error has ocurred: sentence: " + response.sentence + "error: " + response.error); } }, contenttype: false, processdata: false, error: function() { alert("this error getting displayed"); } }); }); });
event.preventdefault
function. you're referencing it, not calling it.
the default action of submit event therefore happen, causing leave page , terminate js.
don't forget put ()
when trying call function.
Comments
Post a Comment