从 Html 调用服务
我想从java脚本调用asp.net web服务并将参数传递给它。是否有任何代码示例或演示可以帮助我实现这一目标? 提前致谢
i want to call asp.net web service from java script and pass the parameters to it .is there any code sample or demostration that will help me to acheive that??
thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
jQuery:
JQuery:
jQuery 支持这种行为。您可以使用 jQuery 进行 ajax 调用,如下所示。该方法有两个成功和失败的回调函数。
jQuery supports this behavior. you can use jQuery to do the ajax call as show below. this method has two call back functions for success and for failure.
您可以使用 AJAX 来执行此操作,并以 JSON 对象的形式从服务器获取响应。
获取 JSON 格式的响应将帮助您将其评估为对象,并且您可以通过 JavaScript 对其进行操作。
请参阅这些链接以供参考:
http://blogs.msdn.com/b/alikl/archive/2008/02/18/how-to-consume-wcf-using-ajax-without-asp-net.aspx
http://dotnetslackers.com/articles/ajax/JSON-EnabledWCFServicesInASPNET35.aspx
You can do so, using AJAX, and get the response from the server as an JSON object.
Getting the response as JSON would help you evualte it asn object and u can act on it through JavaScript.
See these links for reference:
http://blogs.msdn.com/b/alikl/archive/2008/02/18/how-to-consume-wcf-using-ajax-without-asp-net.aspx
http://dotnetslackers.com/articles/ajax/JSON-EnabledWCFServicesInASPNET35.aspx
根据我的经验,下面的链接是一个相当不错的方法。
http://encosia.com/ 2008/03/27/using-jquery-to-consume-aspnet-json-web-services/
The below link is a pretty decent method from my experience.
http://encosia.com/2008/03/27/using-jquery-to-consume-aspnet-json-web-services/