开发者

How to use restfull webservices with jquery [closed]

开发者 https://www.devze.com 2023-03-17 08:45 出处:网络
Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines. It is not currently accepting answers.

We do开发者_如何学JAVAn’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 8 years ago.

Improve this question

Is there any good tutorial and example for restful web services using jquery & xml? I am pretty new to restful web services


How about "Enterprise Mashups with RESTful Web Services and jQuery "? That has code details along with an explanation of how it works.

Part 1

Part 2


It depends on the backend technology you're using, but a general solution with jQuery would be using $.ajax:

$.ajax( {
  type:'post', //Could be 'get' depending on your needs
  url:'http://yoursite.com/yourwebservice',
  dataType: 'xml',
  success:function(data) {
     //Here you have 'data' as xml.
     //You can process 'data' here
  }
});

Hope this helps. Cheers


one more example

this will make an ajax call on page load for .net webservices

$(document).ready(function() {
  $.ajax({
    type: "POST",
    url: "RSSReader.asmx/GetRSSReader",
    data: "{}",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function(msg) {
        //the result will be in msg
    }
  });
});
0

精彩评论

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