I have noticed many code examples of calling a web service which returns json data but the implementation usually involves a back-end language like PHP. Does anyone know of a good tut on an all jQuery solution? Another words something like setting up div tags with id’s then calling the web service directly, getting the json data and populating the page? No PHP or other back-end server side code at all.
Something does not make sense. This works perfectly:
<script type="text/javascript">
jQuery(document).ready(function ($) {
$.ajax({
url: "http://api.wunderground.com/api/ac7e64a2f6e2d440/geolookup/conditions/q/IA/Cedar_Rapids.json",
dataType: "jsonp",
success: function (parsed_json) {
alert(parsed_json.location.city);
var location = parsed_json['location']['city'];
var temp_f = parsed_json['current_observation']['temp_f'];
alert("Current temperature in " + location + " is: " + temp_f);
}
});
});
</script>
But it is not supposed to?
A WebService, implies a client and a server.
A client calls the server and asks for data then waits to receive it from the server in some format (JSON/XML what ever).
Servers are implemented using backend technology – even if you’re using JavaScript with node.js as a server it’s still backend tech.
Building a WebService without a backend means building a website that does not call WebServices… it just has it’s local data setup as JSON and builds the visual rendering of the data using some form of templating (Mustache?).
In any case this is not a WebService this is JavaScript/jQuery driven website construction.