Response.Redirect in Javascript or Jquery


Monday, August 2, 2010

In C# or VB.net, if you wish to redirect page to some other page then you normally use below code

In C#
Response.Redirect("default.aspx");

and In Vb.Net
Response.Redirect("default.aspx")

But what for Javascript and Jquery, how you will use redirect feature in Javascript and Jquery ?

Here is the solution,

You can achive this Response.Redirect feature in javascript and jquery also by below code,


window.location.href = 'http://' + '<%=Request.Url.Host%>' + '/default.aspx';


Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Senior Asp.Net Developer

Email: raj143svmit@gmail.com
e-Procurement Technologies Ltd (India)
www.abcprocure.com


No comments :