as in the title
we’re firing
$('#id').load('someUrl', function(){/*some stuff*/});
But it seems to be being passed to the login form because it’s not logged in?!
The user is logged in. Is this normal?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This happened to me too, but the cause was not that ajax is going crazy – which it may look like – but that the URL was not correct.
The website was initially hosted on localhost, without any alias, so I had a working URL like localhost/controller/action.
Then I moved the website under an alias – so the website’s URL was localhost/alias. At this point, two strange things happaned to SOME ajax requests:
– the requests were prompted for authentication (the website was using windows authentication)
– the requests’ session was different than the one of the page which launched the request
The problem was that some URLs were hardcoded in the js code. So we had code like “
url: '/controller/action'” in the ajax calls code, and this URL didn’t take into consideration the alias under which the website was hosted in IIS.The solution was to declare a js variable in the page and assign it the URL built the right way, with Url.Action, and then use the variable in the ajax call:
Page:
Js file: