Why does this code post data twice ?
$.post("send/user/sent.php", { url: response, secret_key: secret_key },
function(data) {
if (parseInt(data.succ_code) == 0){
// facebook log fired successfully
$('#sent').addClass('good');
$('#sent').html(data.succ_mess+' '+data.point+' point(s) !');
return true;
} else {
$('#sent').html(data.succ_mess);
$('#sent').addClass('bad');
}
}, 'json');
In the database I see two rows for every post.
But if I do this:
$.post("send/user/sent.php", { url: response, secret_key: secret_key },
function(data) {
// facebook log fired successfully
$('#sent').addClass('good');
$('#sent').html(data.succ_mess+' '+data.point+' point(s) !');
return true;
}, 'json');
The data is just sent one time (good).
Can I make the if statement in $.post() success result without this happening?
Here is some code you might want to use: