Using jquery with Spinneret
doggiedoc
Posts: 2,245
I think this is working correctly. I was looking for a way to refresh only one <div> on the page without reloading the whole page. This is what I came up with:
It appears to function as expected; the whole page is obviously not reloading in the browser, just the data.
Any comments or criticisms are welcome. Attached is the project zipped.
Doc
EDIT: It occurred to me that I didn't give credit to Mike G for his help. I've only slightly modified his original code. Thanks Mike! And of course Beau Schwabe's code got me started! Thanks Beau!
DAT index byte "HTTP/1.1 200 OK", CR, LF, { } "Content-Type: text/html", CR, LF, CR, LF, { } "<HTML>", { } "<HEAD>", { } "<TITLE>Willoughby Farm</TITLE>" byte "<script src='http://code.jquery.com/jquery-latest.js'></script>" byte "<SCRIPT LANGUAGE='JavaScript'>",CR,{ } "function timedRefresh() {",CR,{ } " setTimeout('update()',5000);",CR,{ } " }",CR, { } "function update() {",CR,{ } " $('#refresh_data').load('/ #refresh_data');",CR,{ } " timedRefresh()",CR, { } " }",CR, { } "</SCRIPT>",CR, { } "</HEAD>" byte "<BODY Onload='timedRefresh()'>"
It appears to function as expected; the whole page is obviously not reloading in the browser, just the data.
Any comments or criticisms are welcome. Attached is the project zipped.
Doc
EDIT: It occurred to me that I didn't give credit to Mike G for his help. I've only slightly modified his original code. Thanks Mike! And of course Beau Schwabe's code got me started! Thanks Beau!
Comments
What would be nice is a web-camera here so we can check the cat from anywhere!
Works better, spinneret more responsive now and was able to add more images to the slide show now - looks almost like video!
Doc
Question: Does your pictures load from a SD-card or are they stored at an external webserver somewhere?
I have to reorganize my Spinneret myself pretty soon, cause there`s almost no memory left on it.
Thanks for sharing your code, Doc. It will be useful for me aftherwards.