質問

i am creating a website on MVC3. I was using the default VS2010 web server and my login page (using jquery.ajax) was working perfectly fine.

because of some specifications, i had to create an application in my localhost and start using my localhost web server.

thing is that for unknown reasons, my ajax call doesn't even make it to my Action in my controller. It errors as soon as i click Login. i look at errorThrown property and is 'undefined'. I haven't modified at all my login code for at least 3 months, so, that's out of the question. if i use development server it works just fine.

I read a couple of articles here , this one looked like my problem but the solution offered there is not working for me.

thanks

役に立ちましたか?

解決

I guess you hardcoded the url in your AJAX request:

$.ajax({
    url: '/somecontroller/someaction',
    ...
});

instead of using an url helper to generate it:

$.ajax({
    url: '@Url.Action("someaction", "somecontroller")',
    ...
});
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top