JQuery Ajax call gives 404 'Resource Not Found' Error but normal URL call is fine

前端 未结 7 2453
别跟我提以往
别跟我提以往 2020-12-31 18:29

I have a weird problem when using JQuery call in my ASP.NET MVC project. I found that the Ajax call gives 404 ( resource not found error). But when I use the usual URL GET c

7条回答
  •  不思量自难忘°
    2020-12-31 18:49

    Use Firefox Firebug add on, and watch what request gets made by Jquery...

    Is it possible that the page that this Jquery runs in is in a subdirectory, in which case the request will not be relative root as the http://myapp/ "typed in" url is?

    Also, I am guessing the code you specified above is not actually the code you are using (which is completely reasonable, I rairly post code as-is). Because

    $.getJSON("ViewRecord/GetSoftwareChoice", {username='123'},
    

    the = sign between username and '123' is invalid JS as far as I know. So I'm betting there is some goofy detail in the the real code that is causing the problem.

提交回复
热议问题