473,385 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

increase the variable(from 0) till it reaches a predetermined value in a given time

I have made a virtual cricket manager game. In which, a user when plays against another user, a complete match is played and eventally one of the player wins.

What I need is to slowly increase the score from 0 to the final score say 150, in the mean while change other values as of required.

This is bieng done to inrease the friendliness of the game and make it more fun with the suspense of total score till the end.(say in 20 seconds)

I was using AJAX for it, I can store the values in a PHP Array and then display it, so anyways any help in this regard and i would be very grateful to you.

Thanks in advance

Expand|Select|Wrap|Line Numbers
  1.  
  2. function do_ajax(div,i) 
  3.     { 
  4.         var ajax = new Ajax(); 
  5.         ajax.responseType = Ajax.FBML; 
  6.         ajax.ondone = function(data)
  7.         { 
  8.             document.getElementById(div).setInnerFBML(data);
  9.         }
  10.         var params={"over":i}; //add parameters as comma separated "param":value
  11.         ajax.post("http://abcd.com/ajax.php?t=test",params); 
  12.         if(i<20)
  13.         {
  14.         RefreshAjax(div,i);
  15.         }
  16.         else
  17.             return 1;
  18.     }
  19.  
  20.     function RefreshAjax(div,i)
  21.     {
  22.         i++;
  23.         setTimeout(function() {do_ajax(div,i)}, 1200);    
  24.     }
  25.  
This is the code that I was using but if I try to make it any more fast it completely gets spoilt and starts to lag. It works though. Thanks again
Sep 27 '10 #1
1 1196
gits
5,390 Expert Mod 4TB
whatfor is the ajax call good? do you really need to post the values to the server? in that case the request-response-cyles would become relevant since only 2 requests could be processed at a time - so that it could be that it starts to build a queue of requests ...
Sep 27 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: CrystalDBA | last post by:
I am using SQL Server 2000. I need to query my database for all the contracts that came in during a certain time frame (user is prompted for reportingperiodid). Table - Periods Fields -...
1
by: Lei Guangfu | last post by:
Hi, I have a program need to check the value of a application available, and then decide whether to execute codes followed. In order to achieve this purpose, I use DO WHILE loop to judge the...
0
by: Jo | last post by:
Hello, can someone help me? This is the code that I use: Dim rsSelectMandaten As New ADODB.Recordset Set rsSelectMandaten.ActiveConnection = DEData.CnnConnection...
1
by: Grant | last post by:
Hi there, I have taken over this project from someone thats left the company. There were about 5 other projects included in the solution explorer and every time I opened the project, something...
3
by: Brian Foree | last post by:
I am developing an ASP.NET application that uses Access 2000 as its backend, and have just started getting the following error on 2 ASP.NET pages that had been working until late last week (and I...
1
by: Georges | last post by:
Hi! Could someone help? I'm having trouble with the following code. Everythig goes fine till the last line where I'm trying to update the datasource. The program stops executing and displays...
3
by: André | last post by:
Hi, I created a button in order to delete all the records at once in a gridview. But i get the error: No value given for one or more required parameters Thanks André The aspx file contains:...
18
by: Sven | last post by:
Hi, I found a strange behaviour when using the time() function from time.h. Sometimes when it is called, it does not show the correct time in seconds, but an initial value. This time seem to be...
15
by: Dave | last post by:
I am getting the error above intermittantly with an ASP 3.0 page using an MS Access 2003 database. I have searched Google extensively and found the following possible causes for this error: A...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.