The JQuery gets the data and send it to the PHP like this:
$(document).ready(function(){
var email = encodeURIComponent($('#email').val());
var act = encodeURIComponent($('#act').val());
$('#loadingB').fadeIn();
$.ajax({
type: 'POST', url: 'activate.php', dataType: "json", data: { email: email, act: act, },
success: function(result) {
if (!result.success) { timeout = setTimeout(function(){ $('#loadingB').fadeOut(); }, 1500); $('#fail').fadeIn(); }
else { timeout = setTimeout(function(){ $('#loadingB').fadeOut(); }, 1500); $('#success').fadeIn(); }
}
});
return false;
});
The PHP does this:
$email = htmlspecialchars(trim(urldecode($_POST['email'])));
$act = htmlspecialchars(trim(urldecode($_POST['act'])));
$first = mysql_query("UPDATE members SET active = '1' WHERE active_code = '$act' AND email = '$email' ");
$second = mysql_query("UPDATE member_search SET active = '1' WHERE email = '$email' ");
if(is_bool($first) == true && is_bool($second) == true)
{
$response = array(success => true);
echo json_encode($response);
}
else
{
$response = array(success => false);
echo json_encode($response);
}
the "loadingB" div fades in but never fades out to return successful or failure. I believe this is a PHP error. I don't think I'm correctly obtaining if the mysql-query returned true or false.
I know the proper data is being collect by the JQuery because I even echoed it just to make sure, the PHP is just not doing anything with it.
$('#loadingB').fadeOut();? ... which is common to both conditionals, by the way, and can be taken out as a common factor.