Web page question. Populating user data in a page.?
I have a web page in a microprocessor that needs to show the current user settings in the micro (the settings can be changed through the page also, but Im good with that part). I have it working, but I was wondering if there is a better way of doing it. Im fairly new to HTML/Javascript, and as far as I can tell, I can only use GET or POST messages from the page to the micro.
What I do now is send the page out, and when its loaded, send a POST message requesting the data. When the data is received by the page, it populates the fields.
So in the web page I have this:
window.onload=getdata;
function getdata(){
... im skipping some code here because it doesnt matter
var u="setup.cgi?sid="+Math.random();
r.open('POST',u,true);
r.onreadystatechange=function() {rply(r);};
r.send(v); //v is '0', which I use to indicate I want the user settings
}
Is there a better way? I can only use HTML and Javascript as far as I can tell. I dont know if the RTOS will do any other language, besides I dont know them anyway.
EDIT: Microprocessor means the web page is in a microprocessor inside a piece of equipment, not a server. The equipment will sit in a remote, unmanned location. It in effect acts as the server side though.
Like I said, im fairly new to HTML/Javascript, and used some example code as a rough guide to create the web page. The POST message was originally a GET message, but I changed to POST so as to "hide" the actual request data. The "...sid="+Math.random() was in the original sample page, but was used with a GET. I don't know if that makes a difference or not, but regardless, as far as I know, it isn't even looked at by the micro and can be removed.
Errors are handled in the onreadystatechange function, I just didn't show that part because it doesn't have anything to do with the question. I was just wondering if there was a better way to put the user settings in the web page or not. If this is the best way (using HTML/Javascript) then that's fin
EDIT: What I mean is, is there a better way than sending a POST message when the page finishes loading, requesting the user settings, then the server side (the micro) sends the user settings back to the web page where they are displayed.
EDIT: What I mean is, is there a better way than sending a POST message when the page finishes loading, requesting the user settings, then the server side (the micro) sends the user settings back to the web page where they are displayed.