c# - MVC3 deploy to a directory, url issue -
i have mvc3 web application delopyed directory of website. address of application seems http://wwww.xx.com/aopo/. aopo name of directory. after deployement find url in js file not work more. because had write js code hard code url,
$.ajax({url:"/employee/getemployee"})
in case request sent http://wwww.xx.com/employee/getemployee instead of http://wwww.xx.com/aopo/employee/getemployee, , 404 returned. there lots of code in js that. don't want modify js. there simple approach make work? can rewrite request in global.asax.cs?
i believe you'll need change url references this:
$.ajax({url:"@url.action("getemplotee","employee")"})
if script file can write correct url element on page , read that:
<div id='main' data-url='@url.action("getemplotee","employee")' />
then in script:
$.ajax({url:$('#main').data('url')})
rgarding:
there lots of code in js that. don't want modify js
i understand, need use proper helper methods account running under virtual directories, recommending biting bullet , fixing right way.
Comments
Post a Comment