[jQuery] back load livequery
Hello,
I use 'livequery' where Loading function data.
There is a need for the possibility of back of the previous result and
I do not know how to do this.
For example, 3 loading and clicking back-loaded me return to a
previous one, when I click again, back again, I revert to the previous
result loading reply from the server.
This is the form of a tree.
Clicked and the data is loaded, click again load, etc.
But in the last load I can return to the same start clicking, and
gradually go back to the roots.
Do you have any ideas?
me code:
$(function(){
var lastresult='';
var backlink='?module=kategorie&action=getcategory';
var link='';
$('#kategorie-button').click(function(){
$('#miejscowosci-wybierz').hide();
$.ajax({
type:"get",
url: "?module=kategorie&action=getcategory",
success: function(response){
lastresult=response;
$('#kategorie-wybierz-wyniki').html(response);
}
})
$('#kategorie-wybierz').show();
$('#zamknij-kategorie').click(function(){
$('#kategorie-wybierz').hide();
});
});
$('.category').livequery('click', function(){
$.ajax({
type: "get",
url: $(this).attr('href'),
beforeSend: function(response){
$("#kategorie-wybierz-wyniki").html(bar_loading);
},
success: function(response){
if (response == '') {
response=lastresult;
$('#kategorie-wybierz-wyniki').html(msg_brakpodkategori
+response);
}else{
lastresult=response;
$('#kategorie-wybierz-wyniki').html(response);
}
}
});
$('#kategorie-wstecz').html('<a href="'+backlink+'">wstecz</a>');
return false;
});
$('#categoty-back a').livequery('click', function(){
$.ajax({
type: "get",
url: $(this).attr('href'),
beforeSend: function(response){
$("#kategorie-wybierz-wyniki").html(bar_loading);
},
success: function(response){
if (response == '') {
response=lastresult;
$('#kategorie-wybierz-wyniki').html(msg_brakpodkategori
+response);
}else{
lastresult=response;
backlink=link;
$('#kategorie-wybierz-wyniki').html(response);
}
}
});
$('#kategorie-wstecz').html('<a href="'+backlink+'">wstecz</a>');
return false;
});
})