Answer the question
In order to leave comments, you need to log in
Ajax request, how to reset old request?
Good day, the essence of the problem: there are categories that are loaded by ajax in these categories there is data that is loaded by lazy subloading (scrolling down), the problem is that if you do not load the data to the end from one category - this data is loaded in another category ... Those it is necessary that when changing the category, everything is reset. I don't understand how to do it, can someone tell me?
Answer the question
In order to leave comments, you need to log in
var request = $.ajax({....});
request.abort();
var toloadRequest;
jQuery('document').ready(function(){
// клик для загрузки категории
jQuery('.click').on('click', function(){
oneload;
if( typeof toloadRequest !== 'undefined' ) { toloadRequest.abort(); }
toload;
});
// загрузка категории
function oneload() {
$.ajax({...});
}
// ленива загрузка из категории
function toload() {
toloadRequest = $.ajax({...});
}
});
Here is an example code, maybe it's easier to explain what I want to do =))
jQuery('document').ready(function(){
// клик для загрузки категории
jQuery('.click').on('click', function(){
oneload;
toload;
});
// загрузка категории
function oneload() {
$.ajax({...});
}
// ленива загрузка из категории
function toload() {
$.ajax({...});
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question