Good morning,
The request to the Storm Rest UI now is the next, in the same server that
Storm,
var sUrl = "http://localhost:port/api/v1/cluster/summary"
$.ajaxSetup({
"error": function(jqXHR, textStatus, response) {
console.log("jqXHR: " + jqXHR);
console.log("textStatus: " + textStatus);
console.log("Response: " + response);
}
});
$.getJSON(sUrl, function(response,status,jqXHR) {
alert(response);
});
In Chrome, error is "net::ERR_CONNECTION_REFUSED" and in Firefox, you
have to move the resource to the same domain (Activate CORS). How can I do
a request JSON to Storm Rest UI? What am I doing wrong?
Thanks!!!
2014-12-01 17:59 GMT+01:00 Harsha <[email protected]>:
>
> callback param only works in 0.9.3 we don't have it in 0.9.2
> and the url should be http://server:port/api/v1/cluster/summary?callback=
> foo
> than the response will be wrapped in foo(repsonse_json)
> -Harsha
>
> On Mon, Dec 1, 2014, at 08:47 AM, Jose Juan Martinez wrote:
>
> Thanks,
>
> I use storm 0.92, I'll try with version that you say.
>
> In 0.92 version add ?callback param:
>
> $.ajax({
> url: 'http://server:port/api/v1/cluster/summary?callback=?,
>
> dataType: 'jsonp',
> success: function(response) {
> console.log('Data OK ... ');
> },
> error: function(xhr, status, error) {
> console.log('Status: ' + status);
> console.log('ERROR: ' + error);
> console.log('InText: ' + xhr.responseText);
> }
> });
>
> The response is the same error that before, How can I pass the callback
> param in this version?
>
> 2014-12-01 17:23 GMT+01:00 Harsha <[email protected]>:
>
>
> which version of storm are you using? . In storm 0.9.3 we added jsonp
> support
>
> you can pass "callback" query param to the REST Api.
>
> -Harsha
>
>
>
> On Mon, Dec 1, 2014, at 07:51 AM, Jose Juan Martinez wrote:
>
> Hello,
>
> I need to get data from Storm Rest UI, for example,
> http://server:port/api/v1/cluster/summary
> through ajax cross-domain request in javascript.
> My code is the next:
>
> $.ajax({
> url: sUrl,
> dataType: 'jsonp',
> success: function(response) {
> console.log('Data OK ... ');
> },
> error: function(xhr, status, error) {
> console.log('Status: ' + status);
> console.log('ERROR: ' + error);
> console.log('InText: ' + xhr.responseText);
> }
> });
>
> And the response is: "Status: parsererror" storm.js:66
> "ERROR: Error:
> jQuery211012710382721385483_1417447726524 was not called" storm.js:67
> "InText: undefined"
>
> How can i do a ajax cross-domain request in javascript?
>
> Thanks
>
>
>
>
>
>
>