javascript - Why doesn't work (pushstate) -


i'm trying use pushstate. doesn't work. actually, "loadcontent()" function doesn't work. doesn't make difference. i'll show u codes.

javascript:

$(function() {         $('a').click(function(e) {             $("#loading").show();             href = $(this).attr("href");              loadcontent();              // history.pushstate             history.pushstate('', 'new url: '+href, href);             e.preventdefault();           });         // event makes sure back/forward buttons work         window.onpopstate = function(event) {             $("#loading").show();             console.log("pathname: "+location.pathname);             loadcontent();         };      });      function loadcontent(){         // uses jquery load content              $.ajax({               url: "tema/project/content.php",               success: function(e){                      $(".main-div").empty();                     $(".main-div").append(e);               }             });      } 

content.php:

echo "this example show me work."; 

and there's simple html codes doesn't necessary. ok don't understand that, while turn on loadcontent, there's nothing happen. doesn't empty 'main-div' doesn't put content , there ne issue in chrome.

but why? why doesn't work?

any help?


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -