0
主要目的是让数据在excel中变化并将数据返回给某个URL,这样我就可以将数据更新到数据库中。ajax返回值到url
我已经获得了更改数据的值,更改后的数据是一个数组。
如何将它们传递给响应并返回到URL?
下面是代码:
afterChange: function(source, changes) {
var a;
if (changes !== 'loadData') {
$.ajax({
async: false,
url: 'url.com',
dataType: 'json',
success: function(res) {
//get data changed at row
a = hot.getDataAtRow(source[0][0]);
res = a;
//console shows the value of res was changed to a;
console.log(res);
}
});
return a;
}
}
可能重复[如何返回来自异步调用的响应?](http://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-打电话) – RRK
我几乎不知道这个人问什么。 –
我想你需要在ajax调用中指定数据选项。像数据:{dataChanged:hot.getDataAtRow(source [0] [0])},如果需要发送更改的数据 – daremachine