SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Evangelist
    Join Date
    Dec 2005
    Posts
    527
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ajax interactions

    I am coding a chat software using PHP+MySQL+Ajax with prototype

    I have a function that update the chat information each 1 second by setTimeOut (3 Ajax interactions in one functon that refresh users & rooms and texts)
    and I have some buttons that they do some other ajax interactions

    But I have a problem when I upload it in Internet and chek it with low speed :

    always I have failed() function it means my ajax conection Failured see a sample :
    Code:
      var myAjax = new Ajax.Request( 'Chat.php', { method: 'post', parameters: pars , onSuccess: show_users , onFailure:failed });
    I have this problem only in internet not localhost I think it is for responsetime and maybe setTimeout is not good for this because mabe I have some Ajax connections in one time ! (I guess, I dont know problem yet)

    who can help me ?

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2004
    Posts
    1,647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    show us some code....

  3. #3
    SitePoint Evangelist
    Join Date
    Dec 2005
    Posts
    527
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is parts of my code :

    Code:
    <script>
    
    var last;
    
    
    
    
    
    function load_text(originalRequest)
    {
      var xmldoc = originalRequest.responseXML;
      var chat_div = $('chat');
      var message_nodes = xmldoc.getElementsByTagName("message"); 
      var n_messages = message_nodes.length
      for (i = 0; i < n_messages; i++) {
    //show data in page
       }
    	var up = setTimeOut(1000,update);
    	clearTimeOut(up);
    }
    
    function failed(originalRequest)
    {
    //alert('error');
    alert('error');
    }
    </script>
    Last edited by bakhanbeigi; Oct 19, 2006 at 06:14.

  4. #4
    SitePoint Evangelist
    Join Date
    Dec 2005
    Posts
    527
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the error show is in failed() function and I have this error after some menutes working

  5. #5
    SitePoint Evangelist
    Join Date
    Dec 2005
    Posts
    527
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    some times I have this error
    resposneText is null or not an object

  6. #6
    SitePoint Wizard
    Join Date
    Mar 2004
    Posts
    1,647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is the code which trigger ajax...
    i have to see the execution code which do the failed statement..regards

  7. #7
    SitePoint Evangelist
    Join Date
    Dec 2005
    Posts
    527
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you need the PHP (server side ) code ?

    I have this code in many parts of my js code :
    Code:
      var myAjax = new Ajax.Request( 'Chat.php', { method: 'post', parameters: pars , onSuccess:any , onFailure:failed });
    and some times I have this result onFailure:failed not onSuccess
    each time one of this ajax connections


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •