Hello,
I'm trying to make an application requesting info from the webBox to display it on a simple custom webpage. (I have the sunny webbox RPC manual)
I tried using JSONrequest through javascript, supported by Firefox JSON extension : I didn't get any response from the WebBox server :
//-----------------------------------
var url='192.168.0.40';
var TTurl;
var periodicalExecuter;
var mainPeriod = 20; /* the main period of the periodicalExecuter in seconds */
//demande PlantOverView
var req_OVV={
"version": "1.0",
"proc": "GetPlantOverview",
"id": "1",
"format": "JSON"
};
//----------------------------------------------------------------------------------------
//lancer le timer pour rafraîchir les données
window.onload = function()
{
loadFirebugConsole();
periodicalExecuter = new PeriodicalExecuter(ReqInfoPVplant, mainPeriod);
//ReqInfoPVplant(); //initialisation première demande
console.log('démarrage');
}
//fonction de mise à jour de l'affichage
function MAJafichage(requete,reponse,except){
if(reponse){
try{
console.log('réponse existante');
$('energieVar').innerhtml=reponse.result.overview[0].value;
}
catch(e){
alert(e);
}
}
else{
console.log('reponse nulle');
alert(except);
}
}
//lancer la requête RPC
function ReqInfoPVplant()
{
TTurl='http://'+url+'/rpc';
console.log(TTurl);
try{
requete= JSONRequest.post(TTurl,req_OVV,MAJafichage);
}
catch(e){
console.log('trace3');
alert(e);
}
console.log('trace1');
}
//------------------------------------
Did anybody ever try communication with JSONrequest ?
If not, did you ever tried to communicate through XmlHttpRequest : successful ? is there any sample about it or the way to do the HTTP POST with certain JSON request ?
The target URL is only http://IP-adress/rpc or http://IP-adress/rpc/home.ajax or ... ?
It's 3 days long that I'm trying to guess how i have to request the webbox infos and found no solution at the moment.
Please help !
David