2011-12-29, 05:21
Yeah, I'm really new to the whole JSONRPC world, and I'm trying to get it working using jQuery. What I'm doing is:
What I'm getting is a call to the error() method, with jq of:
and text/thrown of "error" and an empty string, respectively.
In Firebug, I see response headers of:
and get a POST result of 200 OK, but then I don't get anything back that makes sense.
Seems like XBMC is returning what it should, but jQuery or Firebuf, one, are throwing their hands up and not showing what's coming back.
Is there something obvious that I should be doing to see the reply?
Thanks lots,
Dave
Code:
$("#clickme").click(function(event){
console.log( "clicked!" );
event.preventDefault();
var urlx = "http://xbmc:8080/jsonrpc";
var request = {};
request.method = "JSONRPC.Introspect";
request.type = "namespace";
request.id = "Introspect";
request.jsonrpc = "2.0";
function goodFN(response)
{
console.log( "good!" );
console.log( response );
};
function errFN( jq, text, thrown )
{
console.log( "error!" );
console.log( jq );
console.log( text );
console.log( thrown );
};
$.ajax(
{
type : "POST",
url : urlx,
data : JSON.stringify(request),
dataType: "text",
error : errFN,
success : goodFN
}
);
});
What I'm getting is a call to the error() method, with jq of:
Code:
Object { readyState=0, status=0, statusText="error"}
and text/thrown of "error" and an empty string, respectively.
In Firebug, I see response headers of:
Code:
Content-Length 23780
Content-Type application/json
Date Thu, 29 Dec 2011 02:54:01 GMT
and get a POST result of 200 OK, but then I don't get anything back that makes sense.
Seems like XBMC is returning what it should, but jQuery or Firebuf, one, are throwing their hands up and not showing what's coming back.
Is there something obvious that I should be doing to see the reply?
Thanks lots,
Dave