更新
我的代码有效.加载页面时
product= [[],[]];
Run Code Online (Sandbox Code Playgroud)
那么在ajax调用之后执行的代码:
$('#contextreload ul').each(function(i, ul) {
product.push([]);
});
$('#contextreload ul').each(function(i, ul) {
allline=i;
$('#reloadajax'+i+' li').each(function(lk, li) {
var lilk = $(li).html(); product[i][lk]=lilk;
// your code goes here
});
// your code goes here
});
Run Code Online (Sandbox Code Playgroud)
使用eval(); 在ajax响应中,在php文件中有一些变化? / endupdate
产物[0] = [1,2,3,4];
产物[1] = [A,B,X,Z];
.
.
产物[10] = [额外,额外,额外,额外];
当我加载页面时执行: product= [[],[],[],[],[],[],[],[],[],[]];
但是,如果我声明这一点,当我打电话AJAX我可以推数据仅添加到这个数组(10行),如果我有11行(product[10][0]和product[10][1]),额外的数据不会被添加.在ajax调用之后我需要额外的数据:product= [[],[],[],[],[],[],[],[],[],[],**[11]**];
这个函数是因为我想在从php文件加载ajax数据后将数据放入数组中.
$('#contextreload ul').each(function(i, ul) {
<strike> var product = $(ul).html(); </strike>
allline = i;
$('#reloadajax'+i+' li').each(function(lk, …Run Code Online (Sandbox Code Playgroud)