Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- consume webservice using dojo
- dojo.query("li").onclick(function(){
- var xhrArgs = {
- url: "http://192.168.1.65:9080/RAD8JAX-RSWeb/jaxrs/customers",
- handleAs: "json",
- headers: { "Content-Type": "application/json"},
- load: function(data) {
- alert("ok");
- console.log(data);
- },
- error: function(error) {
- console.log(error);
- }
- };
- dojo.xhrGet(xhrArgs);
- console.log("message sent ...");
- });
- // Create the store for later use
- var store = new dojo.data.ItemFileReadStore({
- contentType: 'application/json'
- ,clearOnClose: true
- ,urlPreventCache: true
- ,url: "http://192.168.1.65:9080/RAD8JAX-RSWeb/jaxrs/customers"
- });
- store.fetch({
- onItem: function(item, request) {
- alert('I fire after each returned json item')
- }
- ,onComplete: function(items, findResult) {
- alert('I fire when the data has loaded completely.');
- }
- ,onError: function(error, request) {
- alert('I fire when an error occurs');
- }
- });
- store.close();
Advertisement
Add Comment
Please, Sign In to add comment