Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hii ,

I am getting very strange issue

XML
<script type="text/javascript">
      $(document).ready(function () {
          $('[id*=btnShowDetails]').click(function () {
              debugger;
              $(location).attr('href', './AddToCart.aspx?ProductId=3');

          });
      });
  </script>



i am simply redirecting from one page to other .. which is just refresing the page .. however when i put a debugger and tried to check .. it easily gets redirected ..

please suggest on this
Posted

Try to use like this:
XML
<script type="text/javascript">
      $(document).ready(function () {
          $('[id*=btnShowDetails]').click(function () {
              debugger;
             // $(location).attr('href', './AddToCart.aspx?ProductId=3');
            window.location.href = "your URL";
          });
      });
  </script>

Please post back your queries in comments if not solved.
Thanks
:)
 
Share this answer
 
If you set location for refreshing the same page, this is a bad idea. Proper way to reload the current page is, not too surprisingly… location.reload():
http://www.w3schools.com/jsref/met_loc_reload.asp[^].

Your complain about "only in debug mode" is probably wrong observation.

—SA
 
Share this answer
 
Comments
Torakami 15-Oct-14 0:24am    
no .. i am not refreshing same page .. i was trying to redirect to other page.

well thanks for the advice ..
Sergey Alexandrovich Kryukov 15-Oct-14 1:19am    
I'm referring to your own words: "which is just refresing the page". You chose what you want...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900