simple HttpRequests
Sept 15, 2009 23:05:54 GMT -5
Post by Core on Sept 15, 2009 23:05:54 GMT -5
RunBasic passes a JavaScript HttpRequest object as part of its operation.
Because this JavaScript code is in your HTML page you are free to make calls against it.
Here is a small demo that utilizes that code.
To use call the function:
AjaxLiveUpdate(url,id)
url - the document or image you want to load.
id - The html ID of a div to show this data.
benjamin805 has an article on the Wiki on HttpRequests and a demo.
This code utilizes the existing JavaScript thats loaded to the page.
Respectfully,
Core
Because this JavaScript code is in your HTML page you are free to make calls against it.
Here is a small demo that utilizes that code.
To use call the function:
AjaxLiveUpdate(url,id)
url - the document or image you want to load.
id - The html ID of a div to show this data.
benjamin805 has an article on the Wiki on HttpRequests and a demo.
This code utilizes the existing JavaScript thats loaded to the page.
head "<script type = 'text/javascript'>
function AjaxLiveUpdate(url,id)
{
var initialized = newHttpRequest()
if (initialized)
{
var obj = document.getElementById(id);
initialized.open('GET', url);
initialized.onreadystatechange = function()
{
if (initialized.readyState == 4 && initialized.status == 200)
{
// obj.innerHTML = initialized.responseText;
obj.innerHTML = ""<img src =""+url+"">"";
}
}
initialized.send(null);
}
}
</script>"
html "</div>
<div id = 'test'>This space reserved for Pie Chart</div>
<br/>
<input type = 'button' value = 'LiveUpdate' onclick =AjaxLiveUpdate('/chart.png','test');>"
Respectfully,
Core