Reputation: 1
Can anyone tell me how to call a rest service using dojo.io.script.
try {
dojo.io.script.get({
url: "http://search.twitter.com/search.json",
content: {
q: "#dojo"
},
callbackParamName: "callback"
}).then(function(data) {
});
} catch (e) {
alert(e);
}
I tried using the above code, but I didn't get a response. What could be the problem?
Upvotes: 0
Views: 2688
Reputation: 2803
You can call HTTP GET like below:
// The "xhrGet" method executing an HTTP GET
dojo.xhrGet({
// The URL to request
url: "get-message.php",
// The method that handles the request's successful result
// Handle the response any way you'd like!
load: function(result) {
alert("The message is: " + result);
}
});
For more information check documentation here.
Another example is here.
Upvotes: 1