javascript - Returning values from a PHP script for an AJAX method: What am I doing wrong here? -
from i've read on internet, way of returning html, json, etc., php script echo
ing it. can't work, however.
my js
jquery('#new-member').submit( function() { var formurl = jquery(this).attr('action'); var formmethod = jquery(this).attr('method'); var postdata = jquery(this).serializearray(); console.log(postdata); // test jquery.ajax( { url: formurl, type: formmethod, datatype: 'json', data: postdata, success: function(retmsg) { alert(retmsg); // test }, error: function() { alert("error"); // test } } ); return false; } );
and i've verified correctly calling php script, test
<?php echo "yo, dawg."; ?>
but open "yo, dawg."
in new page. expected behavior alert
message on same page on. missing here?
Comments
Post a Comment