开发者

Forgot how to do non-ajax dropdown in MVC

I know this sounds silly but i forgot how to code non-ajax. Specifically: I am in MVC I have a dropdown list with languages. When a language is chosen i want to reload the w开发者_开发百科hole page with the new language. This all works but I have to manually refresh the page. I mean I could call window.location.refresh after i return from the action but i feel like i should be able to do a full refresh. Am i suppose to call submit on a form?

I really feel like i am missing osme extremely easy right in front of my face thing. I have been doing so many partial ajax updates in my life,i lost my plain old post and reload.


Yea you have to do a form submit, but whats wrong with window.location.refresh?


Normally selecting language for a site is independent of other form submissions, and you can get away with a GET instead of POST. So, in the onchange attribute of your select, you can put:

var lang = ...//get selected language value here
document.location = 'http://mysite.com/' + lang //or whatever your URL scheme is
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜