I try to make a html page where I want to show some detail of my RUT955 (GPS coordinates, I/O ...).
I want to do this with the JSON RPC procedure. Like explain in the wiki page I try first this with the add-on of firefox and everything works nice.
Now i'm trying to implement this in a html page (php, javascript or ...) but this doesn't work. Can anyone help me? I show a part of my javascript, maybe I make a small mistake !?
Thanks in advance !
Code:
<html>
<head>
<script src="
http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
<script>
$(document).ready(function(){
$.ajax({
url: 'http://192.168.1.1/ubus',
data: JSON.stringify ({"jsonrpc":"2.0", "id":1, "method":"call", "params":["00000000000000000000000000000000", "session", "login",{"username":"root", "password":"password"}]} ),
type:"POST",
dataType:"json",
success: function (data)
{ alert("The result is : " + data.result);},
error: function (err) { alert ("Error");}
});
});
</script>
</head>
<body>
<h1> JSON RPC 2.0 demo </h1>
</body>
</html>