I don't know javascript very well. I have a LIKE button.
<a href="" onClick="begen(<?php echo $post->ID; ?>); return false;">LIKE</a>
And,
function begen(id)
{
$.ajax({
type:"POST",
url:"begen.php",
data:"id="+id,
cache:false
});
}
begen() sending id of post to begen.php as a POST header .
I'm checking it with is_integer() in begen.php for security
if(!is_integer($_POST["id"]))
die("It's not an integer");
When I test it, begen(3) returning "It's not an integer" . I'm not sure why it's (3) not an integer.
http://forum.jquery.com/topic/ajax-sending-json-data-with-boolean-value#14737000000976384 :
HTTP is a text protocol with no concept of bools or ints, so everything needs to be stringified. The stringification of false is certainly not 0.
If everything is a string, how can I be sure that id is really an id