Hello,
I'm working on the NB web server, I know there is network programing guide talk about this, and the key is the callback function mechanism, it's useful to the 'submit' HTML.
But now web page using Javascript AJAX, there is no 'submit' button, can you tell me how to develop the web server?
SB70LC: web server, AJAX
Re: SB70LC: web server, AJAX
I don't think there is anything netburner specific on this. It is web programming. Doing a quick search on "submit form in javascript" I found there is a javascript submit function: http://www.w3schools.com/jsref/met_form_submit.asp. I do not know much about javascript, but my guess would be that it generates a POST just like an HTML form.
Re: SB70LC: web server, AJAX
...I found there is a key function,
There is no 'submit', here is ajaxRequest.send().
Code: Select all
function ajaxSend(reqtype, url, senddata, callback)
{
var ajaxRequest = null;
var ajaxCallback;
ajaxRequest = new XMLHttpRequest();
if(ajaxRequest)
{
ajaxRequest.open(reqtype, url, true);
if(callback)
{
ajaxRequest.onload = function()
{
var jsonData = JSON.parse(this.responseText);
ajaxCallback(jsonData);
}
}
}
if(reqtype === "POST")
{
ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencode");
}
if(reqtype === "GET")
{
ajaxRequest.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
}
ajaxRequest.send(senddata);
Re: SB70LC: web server, AJAX
That Ajax function should send a "get" or "post" request to the url of the SB70. You will have to write a custom get-handler or post-handler to extract the data. Look at the Web examples, there is one called FlashForm that might be helpful.