jQuery Ajax方法数据参数发送一个数字 [英] jQuery Ajax method data parameter send a Number
本文介绍了jQuery Ajax方法数据参数发送一个数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请原谅我的英语不好,
im使用ajax调用,代码如下:
$.ajax({
url:'fetch.php',
type: 'GET',
**data: { temp : 'counter' },**
success: function(data){
$('#rules2').append(data);
}
问题是我希望计数器为数字...我已经将其设置为 var counter = 1; 但是它只是发送字符串"counter".
对此有任何帮助吗?
我想做的是使用fetch.php文件从数据库中获取一些数据,并通过id获取该数据...所以id是一个数字,我需要使用ajax方法发送一个数字.>
Thx
解决方案
$.ajax({
url:'fetch.php',
type: 'GET',
data: { temp : counter }, // Note the missing quotation marks
success: function(data) {
$('#rules2').append(data);
}
excuse my bad english first,
im using ajax call and the code goes like this :
$.ajax({
url:'fetch.php',
type: 'GET',
**data: { temp : 'counter' },**
success: function(data){
$('#rules2').append(data);
}
The problem is that i want the counter to be a number...i gave already set it as var counter = 1; but what it does is to just send the string "counter".
Any help for this?
What i want to do is to get some data from the db with the fetch.php file and get that data by the id ...so id is a number and i need to send a number with ajax method.
Thx
解决方案
$.ajax({
url:'fetch.php',
type: 'GET',
data: { temp : counter }, // Note the missing quotation marks
success: function(data) {
$('#rules2').append(data);
}
这篇关于jQuery Ajax方法数据参数发送一个数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文