如何从JQuery MVC View调用asmx [英] how to call asmx from JQuery MVC View

查看:77
本文介绍了如何从JQuery MVC View调用asmx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





当asmx在根文件夹中时,我可以从Jquery调用asmx





我的文件夹结构:

-----------------------

次数 - > DC --search.ascx(调用xx.asmx \ getData)





root - xx.asmx





路线总是搜索华盛顿特区的asmx,返回404



请帮忙! !

Hi

I am able to call asmx from Jquery when asmx is in the root folder


my Folder structure:
-----------------------
Views -> DC --search.ascx (call xx.asmx\getData)


root -- xx.asmx


The route is always searches the asmx in DC, returns 404

Please help!!

推荐答案

像这样使用

url:@ Url.Content(〜/)+'xx.asmx'在你的jquery

如果你使用外部js文件然后在视图中添加这个

Use it like this
url:"@Url.Content("~/")"+'xx.asmx' in your jquery
and if you are using external js File then in View add this
<script type="text/javascript" language="javascript">
    window.rootUrl = "@Url.Content("~/")";
</script>



和在js文件中使用它就像thi

url:window.rootUrl +'xx.asmx'


and in js file use it like thi
url: window.rootUrl +'xx.asmx'


这篇关于如何从JQuery MVC View调用asmx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆