$("#div_t td").each(function () {
//alert($(this).text());
$.post("/Home/GetDate", { ID: $("#Name").combobox('getValue'), Date: $(this).text() }, function (data) {
if (data.item != null) {
alert($(this).text());
}
});
})
post前,去DIV下TD的值可以取到,post返回数据后,取值取不到
ajax回调里面的this对象指向ajax的配置,不是dom对象
$("#div_t td").each(function () {
var me = this;///////////
//alert($(this).text());
$.post("/Home/GetDate", { ID: $("#Name").combobox('getValue'), Date: $(this).text() }, function (data) {
if (data.item != null) {
alert($(me).text());//////////
}
});
})
post默认是异步执行的,也就是each的函数先返回了,你需要改成同步执行。