这里是因为有2个地方要在加载时获得数据,所以要2个ajax触发
开始是分开写的,然后发现刷新可能会丢失,于是就这样
$.ajax({
type: 'get',
url: '',
async: true,
contentType: "application/json",
success: function (data) {
$.ajax({
type: 'get',
url: '',
async: true,
contentType: "application/json",
success: function (data) {
}
});
}
});
但是多刷新几次还是会出现丢失的情况,于是想起了document,然后就试了下,果然可以,那么也可以以此类推,触发多个及以上
$(document).ready(function () {
$.ajax({
type: 'get',
url: '',
async: true,
contentType: "application/json",
success: function (data) {
$.ajax({
type: 'get',
url: '',
async: true,
contentType: "application/json",
success: function (data) {
}
});
}
});
})