Basically I'm trying to poll my xbmc using the jsonrpc with the following:
_data = '{"jsonrpc":"2.0", "method":"VideoLibrary.GetMovies", "id":"1"}';
_XBMCHOST = "http://192.168.0.140:8080/jsonrpc";
$.ajax({
      dataType: 'jsonp',
    开发者_Python百科  data: _data,
      jsonp: 'jsonp_callback',
      url: _XBMCHOST,
      success: function () {
          console.log( 'here here here');
      },
      error:function( result ){
         console.log( result );
         console.log('error!!!');
      }
  });
But I keep getting back parsererror. I can however run the same post successfully through curl and get back the desired results, ie:
curl -i -X POST -d '{"jsonrpc":"2.0", "method":"VideoLibrary.GetMovies", "id":"1"}' http://192.168.0.140:8080/jsonrpc
Any suggestions or help would be appreciated.
The curl command you are using is a POST whereas the jquery command is a GET. Try this instead:
$.ajax({
  dataType: 'jsonp',
  data: _data,
  jsonp: 'jsonp_callback',
  url: _XBMCHOST,
  type: 'post', //make this a post instead of a get
  success: function () {
      console.log( 'here here here');
  },
  error:function( result ){
     console.log( result );
     console.log('error!!!');
  }
});
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论