我正试图像这样进行ajax调用:
$.get('/home/myInfo', function (data)
{
....
});
Run Code Online (Sandbox Code Playgroud)
我是从以下页面调用它:http:// localhost/myapp/home/index
当我尝试进行上述调用时,它会转到:http:// localhost/myapp/home/index/home/myInfo
我希望它转到http:// localhost/myapp/home/myInfo
我必须指定绝对URL吗?
我的页面是domain.com/home/details/1
在我的jQuery AJAX调用中,我有以下内容,但当它调用它调用domain.com/home/details/home/getdata时
我该怎么做才能让它得到妥善解决?
$(document).ready(function () {
oTable = $('#example').dataTable({
"bServerSide": true,
"sAjaxSource": "Home/GetData/",
"bProcessing": true,
"bPaginate": true,
"sPaginationType": "full_numbers",
"bFilter": true,
"bAutoWidth": false,
"fnServerData": function (sSource, aoData, fnCallback) {
/* Add some extra data to the sender */
//aoData.push({ "filtervalue": $('#filtervalue').val(), "Options": $('#Options').val() });
$.getJSON(sSource, aoData.concat($('form').serializeArray()), function (json) {
/* Do whatever additional processing you want on the callback, then tell DataTables */
fnCallback(json)
});
}
});
});
Run Code Online (Sandbox Code Playgroud)