Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 0.86 KB  |  hits: 38  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. xbmc jsonrpc and jquery
  2. _data = '{"jsonrpc":"2.0", "method":"VideoLibrary.GetMovies", "id":"1"}';
  3. _XBMCHOST = "http://192.168.0.140:8080/jsonrpc";
  4.  
  5. $.ajax({
  6.       dataType: 'jsonp',
  7.       data: _data,
  8.       jsonp: 'jsonp_callback',
  9.       url: _XBMCHOST,
  10.       success: function () {
  11.           console.log( 'here here here');
  12.       },
  13.  
  14.       error:function( result ){
  15.          console.log( result );
  16.          console.log('error!!!');
  17.       }
  18.   });
  19.        
  20. curl -i -X POST -d '{"jsonrpc":"2.0", "method":"VideoLibrary.GetMovies", "id":"1"}' http://192.168.0.140:8080/jsonrpc
  21.        
  22. $.ajax({
  23.   dataType: 'jsonp',
  24.   data: _data,
  25.   jsonp: 'jsonp_callback',
  26.   url: _XBMCHOST,
  27.   type: 'post', //make this a post instead of a get
  28.   success: function () {
  29.       console.log( 'here here here');
  30.   },
  31.  
  32.   error:function( result ){
  33.      console.log( result );
  34.      console.log('error!!!');
  35.   }
  36. });