开发者

send minus from jquery to php page

开发者 https://www.devze.com 2022-12-20 02:35 出处:网络
now i want send the - i mean Minus one 开发者_高级运维to php but when send it its not sending as a word

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 }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消