jquery - Can you consume ASMX webservices from javascript? - Stack Overflow

Can you consume ASMX webservices directly from JavascriptJQuery?I am having issues hostingdevelopi

Can you consume ASMX webservices directly from Javascript / JQuery? I am having issues hosting/developing a good solution with WCF so I wanted to see what other options are out there as far as connecting my already-developed front end to some backend C# code. For reference there is also a question out there regarding my WCF issue here: Completing the WCF implementation picture

Update: I would also accept as an answer, an alternative solution for me to access c# code. I already have my frontend developed, so I just want to avoid having to replace my GUI elements with ASP.NET runat-server controls! Thanks!

Can you consume ASMX webservices directly from Javascript / JQuery? I am having issues hosting/developing a good solution with WCF so I wanted to see what other options are out there as far as connecting my already-developed front end to some backend C# code. For reference there is also a question out there regarding my WCF issue here: Completing the WCF implementation picture

Update: I would also accept as an answer, an alternative solution for me to access c# code. I already have my frontend developed, so I just want to avoid having to replace my GUI elements with ASP.NET runat-server controls! Thanks!

Share Improve this question edited May 23, 2017 at 11:44 CommunityBot 11 silver badge asked May 10, 2013 at 12:26 ChrisChris 1,14617 silver badges29 bronze badges 2
  • An ASMX web service is just a SOAP web service. You can call it just like any other web service. What did you try? – Panagiotis Kanavos Commented May 10, 2013 at 12:30
  • @ Panagiotis: What I am asking is actually if you can directly access the methods exposed in the ASMX service via javascript. If you read above, I had tried WCF first because that is possible there, but now im looking for other options. Thanks! – Chris Commented May 10, 2013 at 13:25
Add a ment  | 

1 Answer 1

Reset to default 5

As mentioned in ments, ASMX web services are standard SOAP services. And yes, you can call its methods like below:

$.ajax({
  type: "POST",
  contentType: "application/json; charset=utf-8",
  url: "WebService.asmx/WebMethodName",
  data: "{}",
  dataType: "json"
});

You can read more on it in this great tutorial.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745163523a4614512.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信