Checking Returned Data From Php Script Through Jquery
I have written a php script cch.php $stmtcheck = $mysqli->prepare('SELECT id FROM members WHERE email=? AND unlock_code=?'); $stmtcheck->bind_param('si', $_SESSION['unlockema
Solution 1:
In cch.php, if you want to pass only an id to the javascript, you can print id
echo$id;
What ever data is received on ajax response will be passed as parameter to the success callback function. Either you have to execute the success actions inside the succes call back OR You have to write a function to be executed on ajax success and call that function and pass the params
$("#formUnlock").submit(function(e)
{
e.preventDefault();
$.ajax(
{
url: '../scripts/cch.php',
method: 'POST',
data: $(#formUnlock).serialize(),
success: function(responseData)
{
if (responseData == '' )
{
alert("Sorry failed");
}
else
{
alert("Success");
}
}
});
});
Post a Comment for "Checking Returned Data From Php Script Through Jquery"