send minus from jquery to php page
now i want send the - i mean Minus one 开发者_高级运维to php
but when send it its not sending as a word
i cant tell you because i dont understand
see
in php when write "$var"
its return $var
value but when write '$var' its returm $var
how i can make this in jquery
var dataString = 'vote=-1';
$.ajax({
type: "POST",
data: dataString,
cache: false,
});
Try this:
$.ajax({
url:'http://stackoverflow.com/questions/2272337/send-minus-from-jquery-to-php-page',
type:'POST',
data: 'vote="-1"'
});
Using data: {vote:"-1"}
seems to convert "-1"
to a numeric value.
Try this:
var vote_val = -1
$.ajax({
url: "http://your-url.com/goes/here.php",
type: "POST",
data: { vote: vote_val }
});
精彩评论