Web interface: JSON-RPC using JS - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27) +---- Forum: Web Interfaces (https://forum.kodi.tv/forumdisplay.php?fid=156) +---- Thread: Web interface: JSON-RPC using JS (/showthread.php?tid=116734) |
Web interface: JSON-RPC using JS - BASSI3 - 2011-12-12 Hi, I'd like to make my own web interface for xbmc and read through the wiki on the JSON-RPC. After that, I wrote a small script as a basis to communicate with XBMC. Code: var xhr = new XMLHttpRequest(); When I load this script into Chrome, it tells me that Origin null is not allowed by Access-Control-Allow-Origin and won't execute the request. The problem is that the domain which forms the origin of the request differs from the domain of the resource and that's not allowed. What I just need is a little 'hello world' example of how to communicate with xbmc and I'll be ready to go. Thanks in advance! - Kudapucat - 2012-01-06 BASSI3 Wrote:Hi, I'd like to make my own web interface for xbmc and read through the wiki on the JSON-RPC. After that, I wrote a small script as a basis to communicate with XBMC. This is a security issue. Ajax will not make calls outside your domain. You can fix this by making a php proxy file. See http://jquery-howto.blogspot.com/2009/04/cross-domain-ajax-querying-with-jquery.html for more information. OK, for my question. Now that I can load http:192.168.0.1:8080/jsonrpc what the hell do I do next? I have a controller working using the depreciated "xbmcCmds/xbmcHttp?command=" format, but I now want to do the same with JSON. When I try anything, all I get back is "JSONRPC active and working" How do I get JSON data out of the XBMC using java? I'm sure it's simple, but having never used JSON before, I'm at a loss. - gugahoi - 2012-01-06 Kudapucat Wrote:This is a security issue. You will probably need to import an external library. I would start here but I'm no java expert and there might be better libraries out there. You will need to use a jsonrpc object and from it make your calls. Python example: Code: xbmc = jsonrpclib.Server(xbmc_json_address) - Kudapucat - 2012-01-07 Hmmm sorry. I'm trying to use AJAX and JavaSCRIPT in a client-side processor. JavaScript comes with an object that can be used for JSON. I just don't know what to do, I can't see the data. Do I need to post something to xbmcip:port/jsonrpc before I'll get data? What will the data look like if I don't process it? Just an XML style page? - gugahoi - 2012-01-07 Kudapucat Wrote:Hmmm sorry. I'm trying to use AJAX and JavaSCRIPT in a client-side processor. This might be useful for you -> http://barracudaserver.com/doc/WebServices/JRpcDoc.html But the way I would do it is have a php page with all the methods you might need and assign them some get parameters like "?action=play" and when that is set call the appropriate php method for that. I do no think javascript alone with get you any results. A good php library for you would be XBMC-PHP-RPC RE: Web interface: JSON-RPC using JS - Tom83 - 2023-02-08 Another option is to consider implementing JSON-RPC functionality over WebSocket with JSON parser and emitter and embedded JS engine. RE: Web interface: JSON-RPC using JS - izprtxqkft - 2023-02-08 @Tom83 are you aware you just replied to an 11 year old post and the original conversation was had by people who probably arent around anymore? |