我有一个脚本,每5秒运行一次,作为一个轮询AJAX HTTP请求。试图增加一个JavaScript计数器,当使用轮询AJAX http请求
我想通过它来发送一个递增量,对每个请求(1,2,3,4,5,6等)
我有这到目前为止,但代码只需发送“ 1“。
// set the value to 1
var state = {
recordId: 1
};
$.ajaxPoll({
url: "map-service.cfc?method=getpoints",
type: "POST",
data: state,
dataType: "json",
successCondition: function(location) {
// return result != null; // custom condition goes here.
// increment it by 1
state.recordId = state.recordId +1
alert(state.recordId)
}
有谁知道如何通过POST中的'data'参数提交递增值吗?