Antonio Testa Posted May 29, 2020 Share Posted May 29, 2020 Hello folks, My simple code bellow is not working !!!☹️. The value for <div "X0"> is updated only once. The value for <div "X2"> is never updated. I want to have both X0 and X2 updated every second.... Any suggestion ? Thanks a lot. Antonio... <html><head> <script src="http://code.jquery.com/jquery-latest.js"> </script><script> $(document).ready(function update(){ $('#X0').load("urlforX0"); $('#X2').load("urlforX2"); setTimeout(update,1000);} ); </script></head> <body> <div "X0"></div> <div "x2"></div> <script>update();</script> </body> </html> Link to comment Share on other sites More sharing options...
Funce Posted June 8, 2020 Share Posted June 8, 2020 Hi Antonio Your update function only gets defined once the page has loaded. You're calling update before its fully loaded. If you want to call it immediately, put the update() right after the function definition. Link to comment Share on other sites More sharing options...
Ingolme Posted June 8, 2020 Share Posted June 8, 2020 The update() function will run when the page loads (it is being passed as an argument to the ready() function) , but it won't find the elements because they don't have id attributes. Link to comment Share on other sites More sharing options...
Makwana Prahlad Posted June 10, 2020 Share Posted June 10, 2020 Hello, @Antonio Testa Please try this code,To Script does not work as expected !!! Move the following code from the <head> to just above the closing </body> tag <script type="text/javascript"> var c = document.id('right_column').getElement('#float_block'); if (window.getSize().x < 1260 /*|| (c && t > p)*/){ document.id('float_block').inject(document.id('float_block_default')); } else{ if (!c) document.id('float_block').inject(document.id('right_column')); } </script> I hope this code will be useful. Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now