|
Sure you can, but that's quite a bit more complex. It would require a
newer browser, which most everyone has these days, that can support
AJAX calls [Internet
Explorer 5.0 and up, Opera 7.6 and up, Netscape 7.1 and up, Firefox 1.0
and up, Safari 1.2 and up, among others.
] AJAX (Asynchronous _javascript_ and XML) is considered a Web
2.0 technology, and powers most the "cool" new stuff of the web.
Things that come to mind are most of the Google tools (Gmail, Google
Maps, Calendar, Documents, etc). The biggest thin AJAX lets you do is
make http page calls without leaving the current page - exactly what
you'd want to do with a data call to owhttpd. AJAX tends to be much more complex than my original suggestion, and in my experience, is much more difficult to debug when it's not working the way you want. That said, here's another very rudimentary example. It's a proof of concept that would have to be re-worked if you wanted to call more than one parameter in the same page from owhttpd. The first is your data content file. I'm assuming it to be a plain text string. This example uses a static text file, but a URL to an owhttpd can be substituted straight away to get OWFS data. // Begin OWFS file ajax_response.txt ///////////////////////////// 98 // Begin OWFS file ajax_response.txt ///////////////////////////// // Begin HTML file display.htm///////////////////////////// <html> <body> <!--- This AJAX code was borrowed from http://www.w3schools.com/Ajax/ajax_server.asp & modified for this purpose ---> <script type="text/_javascript_"> function ajaxFunction() { var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } xmlHttp.> { if(xmlHttp.readyState==4) { document.getElementById("result").innerHTML = xmlHttp.responseText; } } //change this line to point to the URL of your owfs data file or owhttpd URL xmlHttp.open("GET","ajax_response.txt",true); xmlHttp.send(null); } </script> <INPUT type="button" value="Click to update OWFS data" > <BR> <DIV>Temp: <SPAN id="result">Data not yet fetched</SPAN> </DIV> </body> </html> // End HTML file display.htm///////////////////////////// There's whole development projects out there to create easy wrappers around AJAX to simplify coding. Prototype.JS is one I've used in the past, but there's numerous available: http://www.infoq.com/news/2006/12/ajax-comparison-tools -Scott Paul Alfille wrote: Very interesting. |
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________ Owfs-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/owfs-developers
