Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 12-27-2008, 03:02 PM JS Get Problem
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
I am sending a request to ajax/matchreport.php along with the attribute ?minute=x when the request comes back i want it to add 1 to the minute and then resend so:

ajax/matchreport.php?minute=0
ajax/matchreport.php?minute=1

Using this code the first time the request does it correct then it enters NaN instead of a number after minutes

ajax/matchreport.php?minute=0
ajax/matchreport.php?minute=NaN

Any ideas??

Code:
<script language="javascript" type="text/javascript">
<!-- 
function MatchController(match_id) {
this.match_id = match_id;
this.minute = Number(0);
}
MatchController.setMinute = function(minute) {
minute = Number(minute);
this.minute = (minute - 1) + 1;

MatchController.setGame();

}
MatchController.setGame = function() {
// Display Loading Image
document.getElementById('loading').innerHTML="<img src='images/css/ajax-loader.gif' class='noimg' /> Playing Match";
    var ajaxRequest;  // The variable that makes Ajax possible!
    try{
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } catch (e){
        // Internet Explorer Browsers
        try{
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try{
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){
                // Something went wrong
                alert("Your Browser Does Not Support Ajax/Javascript!");
                return false;
            }
        }
    }
    // Create a function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function(){
        if(ajaxRequest.readyState == 4){
// Hide Loading Image Then Re Send The Function If Minutes Under 90
document.getElementById('loading').innerHTML="";
MatchController.setMinute(this.minute);
}
}
    var queryString = "?minute=" + Number(this.minute);
    ajaxRequest.open("GET", "ajax/matchreport.php" + queryString, true);
    ajaxRequest.send(null);
}

</script>

Last edited by evans123; 12-27-2008 at 03:09 PM..
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
 
Register now for full access!
Old 12-27-2008, 05:24 PM Re: JS Get Problem
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
You will need to recode it to use a "reusable" request object then use a setInterval() loop to call the function.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to JS Get Problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.57214 seconds with 12 queries