Page not redirecting -Jquery

Posted by RMN on Stack Overflow See other posts from Stack Overflow or by RMN
Published on 2012-11-02T16:59:09Z Indexed on 2012/11/02 16:59 UTC
Read the original article Hit count: 155

Filed under:
|
|

I have page1.aspx and page2.aspx in a website

I need to navigate as: Page1--> Page 2(on click of go back button, back to page1)--> page 1

I am using jQuery code to navigate:

   var pagename= "page2.aspx";
   jQ(location).attr('href', pagename);

I tried using same code in page2 to navigate back to page 1:

var path2 = "page1.aspx";
        jq(location).attr('href', path2);

also tried below code and similar few others as well.

document.location.pathname = '../Pages/page1.aspx';

But all it does is, navigate me to show Directory Listing, where it shows all page names under pages folder. Is there anything wrong with the code ? I tried to do it as per levels too, that is ../pages/page1.aspx .

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about redirect