If you do it like this (which isn't necessary with proper HTTP
headers), you can use:
'&cb=' + (new Date()).getTime()
instead. This guarantees a unique number everytime (except if you have
more than a thousand requests per second from the same client; but
that wouldn't work anyway).
Best,
Thomas
Am 21.11.2007 um 17:14 schrieb Brian Williams:
> sounds like the ajax caching bug, where the browser will use the
> cache to grab data from if the url doesn't change.
>
> in my experience FF doesn't usually have this problem
>
> is used this function
>
> function cBuster(){
> var cBuster=parseInt(Math.random()*99999999); // cache buster
> return cBuster;
> }
>
> and in the ajax.updater i added
>
> var params = 'action=getsomething&id=' +
> document.Frm.user_list[document.Frm.user_list.selectedIndex].value +
> '&cb='+cb;
>
> basically it appends a random 8 digit number to the URL so that the
> browser always thinks its a new visit. Another way you could do it
> is via the headers of the returned page pragma:no-cache and there
> are a couple of other ways but the above seemed to be the simplest.
>
> HTH
>
> On Nov 20, 2007 11:27 PM, kenq <[EMAIL PROTECTED]> wrote:
>
> I am having trouble with the following;
> onClick="updateMysql()" calls getNextTelephone() onSuccess, this
> returns the next telephone from a list and sets the global variable
> globalTelephone with the new telephone number. The next onClick will
> use displayNextTelephone() to change the telephone number with the
> new one getNextTelephone() set the globalTelephone to previously. When
> you click the button it gets and displays the next telephone from the
> list. This works fine in Firefox but IE6 displays the first telephone
> number and then nothing. When I reload the page with SHIFT it still
> displays the first number. When I restart IE6 it gets the next number
> but that is it.
> Any help would be appreciated.
> Thanks
> Ken
>
> <html>
> <head>
> <title>Example</title>
> <script language="Javascript" src="includes/scripts/prototype/
> prototype.js "></script>
> <script language="javascript" type="text/javascript">
>
> var globalTelephone = '';
>
> function updateMysql() {
> displayNextTelephone();
> var url = "update_mysql.php";
> new Ajax.Request(url, {
> asynchronous: true,
> method: "get",
> onSuccess: function(request) {
> getNextTelephone();
> },
> onFailure: function(request) {
> alert('error');
> }
> });
> }
>
> function displayNextTelephone(){
> $('telephone').value = globalTelephone;
> }
>
> function getNextTelephone(){
> var url = "get_next_telephone.php";
> new Ajax.Request(url, {
> asynchronous: true,
> method: "get",
> onSuccess: function(request) {
> results = request.responseText ;
> },
> onFailure: function(request) {
> alert('error');
> }
> });
> globalTelephone = results;
> }
>
> </script>
> </head>
> <body>
> <form action="post";
> <p>
> Telephone: <input type="text" size="10" id="telephone" />
> </p>
> <button type="button" name="button" onClick="updateMysql()"> Get Next
> Telephone
> </button>
> </form>
> </body>
> </html>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---