Tell me, there is such a ajax code:

 <script> $(function () { $("a[rel='footer']").click(function (e) { pageurl = $(this).attr('href'); $.ajax({ url: pageurl + '?rel=footer', success: function (data) { $('.container').html(data); } }); return false; }); }); </script> 

How to make the url change to a page that loads? It is necessary that when you click on the link of such a sample on the page so the .container block was cleared, and then the information was loaded into it with ajax, with this changing the url. Help, please remake. I suffer a lot with this!

    3 answers 3

    What does url mean in your question? If you mean the url of the link you clicked on, then everything is simple ..

     <script> $(function(){ $("a[rel='footer']").click(function(e) { var that = $(this); pageurl = $(this).attr('href'); $.ajax({url:pageurl+'?rel=footer',success: function(data){ $('.container').html(data); that.attr('href', '_нужный_url_'); }}); return false; }); }); </script> 

    If you mean something else, then explain the question.

    • Does not work = ( - OverLoader

    This can be implemented using the History API, does not work in all browsers, here is an article on Habré