javascript - checking JSON data with jQuery -
i have written php script:
cch.php:
$stmtcheck = $mysqli->prepare("select id,email,location members email=? , unlock_code=?"); $stmtcheck->bind_param("si", $_session['unlockemail'], $_post['code']); $stmtcheck->execute(); $stmtcheck->bind_result($id,$email,$location); $stmtcheck->fetch(); $array=array($id,$email,$location); json_encode($array); $stmtcheck->close();
and jquery submitting form is
recover.php:
$("#formunlock").submit(function(e) { e.preventdefault(); $.ajax( { url: '../scripts/cch.php', method: 'post', data: $(#formunlock).serialize(), datatype: 'json', success: function() { } }); });
the script returning more 1 variable , returned data should in json format.
how read data in jquery?
$("#formunlock").submit(function(e) { e.preventdefault(); $.ajax( { url: '../scripts/cch.php', method: 'post', data: $(#formunlock).serialize(), datatype: 'json', success: function(data) //parameter missing { var json = $.parsejson(data); console.log(json); //in console result response } }); });
Comments
Post a Comment