Hi team,
Need urgent help
i am facing issue with multile ajax call. in below senariyo.
total hotel record near about 2000
while user hit submit button i am fatching near out 300 record and out of that i am display 5 record in page lode ( 5 recrod becouse we have implemented paging)
- Once page is fully loded there is another ajax method which is fatching remaing hotel record from WebMethod
- There is one more ajax call which will hit, If user scroll down it will fetch data from another webmethod which have hotel data in session out of 300 record.
problem : i am facing issue that if my point 1 is hit to one webmethod i am not able to get responce of point 2 ajax call till point 1 is finish. my both ajax method is async: true,
for reference below is my code
ajax call 1
$(window).load(function () {
$.ajax({
type: 'POST',
contentType: 'application/json; charset=utf-8',
url: HotelUrl,
data: '{}',
async: true,
beforeSend: function () {
},
success: function (data) {
error: function (jqXHR, textStatus, errorThrown) {
},
complete: function () {
}
});
}
});
ajax call 2 :
$(window).scroll(function () {
if (($(window).scrollTop()) == $(document).height() - $(window).height()) {
pageIndex++;
Filters.PageIndex = pageIndex;
$.ajax({
type: 'POST',
contentType: 'application/json; charset=utf-8',
url: '/AjaxCall.aspx/LoadHotels',
data: '{FilterOption:' + JSON.stringify(Filters) + '}',
async: true,
beforeSend: function () {
},
success: function (data) {
},
error: function (jqXHR, textStatus, errorThrown) {
},
complete: function () {
}
});
}
});