![]() |
'$.getScript()' question!
Hey CodingForums and coders!
I'm coding plugin for a website and websites has good APIS to example check when someone joins to chat and to send automatically message: 'Welcome' etc. So I'm coding /update command to my 'chatbot' and was goin to use $.getScript to get newest, updated script from url and run it again / replacing old code. So everytime when I send to chat '/update' chatbot will run function update. What do I need to do to replace the old code with the new code? Here's something what I tried and I think it's working, or is it? Code:
$.getScript(url,function(){If you need more details comment below... ~Thanks, ECode |
I'm sure someone could help me out even a bit!
*BUMP*! |
Quote:
5) Do not bump your thread repeatedly when you don't get a response. Sometimes when you post for help, you may not get a response in a timely matter, if at all. Forums aren't wishing wells, and some questions will fall through the cracks. That's a fact of life. It's ok to occasionally bump a thread, but only when done after an ample amount of time (ie: 2-3 days) have passed without a response, and never more than once. Your thread is no more important than another member's when it comes to the amount of attention it should receive. |
Ok I'm trying to re-post this to other forums if one of them could answer :)
|
Couple days since no1 answered!
So now I can *bump* *bump* it ! |
If you just want to force the script to download when they first access the page rather than using a cached copy then just add a querystring on the end of the src attribute of the script tag with a value that is always changing (the easiest way is to use server side code to insert the date/time).
To replace a JavaScript with the latest version dynamically at regular intervals while they are still on the page you just need to run the appropriate DOM commands to replace the script tag in the page and add a different value in the querystring so that it forces it to redownload the script rather than usung the cached copy. for eexample the following will reload script.js from the server every five minutes (you just need to add id="js" to the script tag so it knows which tag to replace) Code:
setInterval( |
Quote:
I really appreciate that you answered, thanks again :D! |
| All times are GMT +1. The time now is 12:56 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.