Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Consuming RESTful web services with jQuery

Posted on 2011-02-14
10
Medium Priority
?
1,127 Views
Last Modified: 2012-05-11
Greetings,

I need to find a tutorial on this topic, something that gives a well-defined, high-level view as well as (if possible) some actual coding examples to work through so I can get a feel for this type of work.  

Regarding details, I need something that (preferably) deals with the Zend Framework and output in JSON.

Thanks.
0
Comment
Question by:max7
  • 5
  • 3
  • 2
10 Comments
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 800 total points
ID: 34889915
0
 
LVL 1

Author Comment

by:max7
ID: 34897972
Thanks for that ... if I'm not mistaken, both links point to the same article.

Also, this tutorial deals only with ASMX which I believe is related to .NET web technology.  Anything related to PHP out there?
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 34898500
actually it doesn't matter which is the server side technology, since the format of request and response is decided  by your rest service and protocol is anyways same http.

So, go ahead and try the same
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 82

Expert Comment

by:leakim971
ID: 34903283
0
 
LVL 1

Author Comment

by:max7
ID: 34906980
>>>actually it doesn't matter which is the server side technology, since the format of request and response is decided  by your rest service and protocol is anyways same http.

So basically, are you saying that if the output is in JSON, the way jQuery would handle that response is the same, regardless whether or not it's a PHP or .NET backend?
0
 
LVL 1

Author Comment

by:max7
ID: 34907058
leakim971:  that's a great example but I don't see where jQuery is used to consume the web service.  Please pardon my ignorance if it's apparent but could you point it out to me?
0
 
LVL 82

Expert Comment

by:leakim971
ID: 34907126
You want to consume the wb at the server side (php/zend) or from the client side (jquery) ?
0
 
LVL 1

Author Comment

by:max7
ID: 34907878
I need to consume from the client side using jQuery.  the web services are RESTful and output JSON.
0
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 1200 total points
ID: 34908102
with jQuery this can be a simple line : http://api.jquery.com/jQuery.getJSON/

You need to have the same domain and protocol for the client and the server ( url in the browser and url in the ajax call $.getJSON(url,callbackFunction

else you need to handle JSONP on the server or use a proxy

$.getJSON("/path/to/webservice/youfunction/param1", function(data) {
      // do something with the data back if needed
});

Open in new window

0
 
LVL 1

Author Closing Comment

by:max7
ID: 34909819
Undoubtedly, I will have more questions on this topic but for now this is a good start.  Thanks to you both.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question