Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Closing socket to client and continuing script execution

    I am developing some AJAX apps and I need to close the socket connection with the client so the browser will execute the server response without waiting for the script to complete it's execution.

    Here's what I want:
    Code:
    <?php
    $bar = $_POST['foo'];
    echo "alert('You said '".$bar."')";
    
    // close connection with client so browser evaluates server response
    
    someFunctionThatTakesALongTime();
    ?>
    Any help would be most appreciated.

  • #2
    Regular Coder
    Join Date
    May 2006
    Location
    Wales
    Posts
    820
    Thanks
    1
    Thanked 82 Times in 79 Posts
    Use flush(); to force anything echoed so far in the script to be outputted


  •  

    Posting Permissions

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