简体   繁体   中英

MVC2 Routing + Ajax ==?

Im touching up an mvc2 application thats nearly complete, I have some ajax requests that end up looking alot like

www.host.com/site/controller/action?UserName=asdf&UserPassword=asdfasdf&Email=asd%40df.com&PhoneNumber=541-345-5433&CompanyName="sdf"

So my question is how (if possible) can I mask the ajax url on the redirect to simply be.. /controller/action, Im getting the feeling I broke pattern with my ajax and am stuck with nasty URLS.

any mvc2 gurus out there willing to clarify?

Assuming you are using jquery try this:

 $.ajax({ url: '/controller/action';, data: { UserName: 'asdf', UserPassword: 'asdfasdf', Email: 'asd%40df.com', PhoneNumber: '541-345-5433', CompanyName: 'sdf' }, success: function(req, status, error) { updateSucceeded(); }, error: function(req, status, error) { updateFailed(error); } }); 

Be happy and enjoy life.

First things first, I would say never send a password through a URL variable. They're totally sniffable even if you're using HTTPS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM