You can communicate with server side scripts easily using following function:
myscada.sendDataToServerSideScripts(data,callback);
First parameter is data you wish to send, and second is a callback function which is called after the server side script replies.
Example:
myscada.sendDataToServerSideScripts('some data',function(reply) { //in reply we have response from server side script (main.js) alert(reply); } );