views:

45

answers:

2

Hi,

I am implementing live search and when the user selects any of the options then accordingly the page gets redirected depending on the option selected.

I have jquery for implementing live search .

In the select option :-->> I want to redirect my page to Index Function in the HomeControllers file using javascript. The Index function has a few parametres inside it ...

I am not able to redirect ... the url to which i want to send .. gets appended to the current url.

I am doing window.location = "Home/Index/"+ ui.item.value;

kindly suggest what to do ??? waiting for a reply soon.

A: 

You're using a relative URI. You need to use an absolute URI. So instead of

window.location = "Home/Index/"+ ui.item.value;

Do

window.location = "/Home/Index/"+ ui.item.value;

Note the extra /

Craig Stuntz
A: 

You could do it in this way

window.location = '<%=Url.Action("Index", "Home")%>?/' + ui.item.value;
Dennis Cheung