Solved

Consuming RESTful web services with jQuery

Posted on 2011-02-14
10
1,111 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:
gurvinder372 earned 200 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:gurvinder372
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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
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 300 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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.

685 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