WorknHardr
asked on
Using Jquery AJAX in seperate Script File?
Since I moved my scripts from the MVC view into separate .js file, it cannot connect to another controller Action anymore.
Q. Can a AJAX work correctly in a separate .js file?
Q. Can a AJAX work correctly in a separate .js file?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The js file may be in a different location from where it was originally run, thus you need to change the URL parameter of your ajax call.
For example if you use jquery ajax, implement the error method and post the error message. As stated previously by CraigWagner, Fiddler can help to capture the call interaction and find the error.
For example if you use jquery ajax, implement the error method and post the error message. As stated previously by CraigWagner, Fiddler can help to capture the call interaction and find the error.
ASKER
I've found many solutions where adding / solved their issue like so:
/controller/action
or:
/controller/action/
instead of:
controller/action
I'm curious if this would work:
var URL = document.location
URL/controller/action
/controller/action
or:
/controller/action/
instead of:
controller/action
I'm curious if this would work:
var URL = document.location
URL/controller/action
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent, thx both...
ASKER