diff options
author | makkalot <makkalot@gmail.com> | 2008-07-21 18:03:47 +0300 |
---|---|---|
committer | makkalot <makkalot@gmail.com> | 2008-07-21 18:03:47 +0300 |
commit | e34a6edec07294f35ed37535fdb460d8c5ac9f11 (patch) | |
tree | 8d36d3e59002702b83c486e309635bf7d7cb3496 /funcweb/funcweb/static | |
parent | 47ebe7b62ad0f3e6478950ac9aaeb90d701f4011 (diff) | |
download | func-e34a6edec07294f35ed37535fdb460d8c5ac9f11.tar.gz func-e34a6edec07294f35ed37535fdb460d8c5ac9f11.tar.xz func-e34a6edec07294f35ed37535fdb460d8c5ac9f11.zip |
adding some polling js code to see if we have some interesting change in async results
Diffstat (limited to 'funcweb/funcweb/static')
-rw-r--r-- | funcweb/funcweb/static/javascript/async_tools.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/funcweb/funcweb/static/javascript/async_tools.js b/funcweb/funcweb/static/javascript/async_tools.js new file mode 100644 index 0000000..44e4dc8 --- /dev/null +++ b/funcweb/funcweb/static/javascript/async_tools.js @@ -0,0 +1,35 @@ +function poll_async_changes(result){ + + /** + * Simple method that calls another to check the async results + */ + + //runs on the index page and polls the server side if there is new + //change in the async db + if (result['changed']==true){ + //alert('Check it '); + var the_change_msg = "We have some async changes : "; + the_change_msg = the_change_msg + repr(result['changes'])+" check the RESULTS page!"; + getElement('globalerror').innerHTML = the_change_msg; + window.setTimeout('check_async_change()',50000); + } + else + window.setTimeout('check_async_change()',50000); +} + +function check_async_change(){ + /** + * Method that sends the xmlhttp request to check the changes + */ + d = loadJSONDoc("/funcweb/check_async?"+queryString( + { + 'check_change':true + } + )); + d.addCallback(poll_async_changes); + +} + +function poll_error(error){ + alert("Some error in xmlHttpRequest check your connection : "); +} |