I need some solution to give relative path in my jquery ajax call as of now I am using soem thing like ../ . Any suggestions would be higly appreaciated.
Code
$.ajax({
type: 'get',
url: '../../MyPage/getDetails',
success: function (data) {
if (data > 0) {
This is a bit of a hack, but you are client side so 🙂
This code makes some assumptions – like that the script tage for
myscript.jsexistsAssume you have some markup on your page like so:\
OK, now we will use the script tag and get the base url from that 🙂
Let’s create a Util class we can use, add a get base url method and alert that value:
Working copy here: http://jsfiddle.net/SmCLy/
SO, on your page you could do: