开发者

ajax post url issue using jquery

i request a ajax call using jquery

$.ajax{}

on url parameter i hardcoded the path as

开发者_如何学Python
"/Home/Ajaxpost"

its working fine with default, but i hosted in IIS so the project name included in path

like "/Project/Home/Index" so now if the request goes lik "Home/Ajaxpost" fails Action not found.

How can i dynamically set the path for ajax call.


Try using this:

$.ajax('<%=ResolveUrl("~/Home/AjaxPost")%>',{},function(){});


$.ajax {
location.host+'/Home/Ajaxpost'
}

location.host returns/sets the hostname and port number of the current URL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜