javascript - jquery address plugin issue -


i’m using jquery address plugin , have implemented plugin on listing page , when click on 1 of links , function pull data using ajax , content , overwrite current list html , page has ‘back’ button , use window.history.back() go listing page , work fine until point , after when click again on 1 of links again , jq address behavior lost .

the open_ajax function used pull data , inserted in paginatedcontent html div

$(document).ready(function(){     refreshjqaddress(); });  function refreshjqaddress(){     mainpath = "";      if($('.jqaddress').length > 0){         $.address.init(function(event) {             $('.jqaddress').address(function() {                  return $(this).attr('href');             });         }).internalchange('change', function(event) {             path = event.value;              var ran=math.random();              urlpath = path;             console.log(urlpath);              alert(urlpath);             open_ajax(urlpath);             mainpath = urlpath;         }).externalchange(function(event) {             var windowloc = window.location+"";              hashindex = windowloc.indexof("#");              if(hashindex > 0){                 newloc = windowloc.substring(hashindex+1);                 mainloc = windowloc.substring(0,hashindex);                 if(mainloc.indexof("http://") > -1){                     mainloc = mainloc.replace("http://","");                      indexof = mainloc.indexof("/");                     mainloc = mainloc.substring(indexof);                 }                  mainpath = mainloc;                 windowloc = newloc;             }              if(mainpath == ""){                 mainpath = windowloc;             }              if(windowloc != mainpath){                     var ran=math.random();                  open_ajax(windowloc);                            }         }).history(true);     } }  var olddata; function open_ajax(path){        var ran=math.random();      if(path.indexof("?") > 0){         urlpath=path+'&'+ran;     }else{         urlpath=path+'?'+ran;     }      olddata = $('#paginatedcontent').html();      $.ajax({         url: path,         async: false,         beforesend:function(data){                       $('#paginatedcontent').html("<div class='loaderdiv'><img src='/img/ajax-loader.gif' alt='' /></div>");          },         success: function(data) {             $('#paginatedcontent').html("<div class='ajaxdatadiv' style='display:block'>"+data+"</div>");              if($("#hidden_meta_title").length > 0){                 document.title = $("#hidden_meta_title").html();             }              $(".relatedbannersalbums").show();         }     }); }   function back_btn(){         window.history.back(); } 


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -