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
    Mar 2009
    Posts
    1
    Thanks
    1
    Thanked 0 Times in 0 Posts

    problem: ajax call v.s. opening page directly

    if I open the php file directly, it will generate the "mytest" file.
    If I use ajax to call the php file however, SOMETIMES it works, but other times the "mytest" file will not be generated.
    However I do receive the "hi" back from the ajax call every time.

    Does anyone know why this is?

    Code:
    <?php
    
    $profile_name=$_GET["my_name"];
    
    
    $file_path = "/mytest";
    
    $file=fopen($file_path, "w");
    
    fwrite($file, "test...");
    
    fclose($file);
    
    echo "hi";
    
    ?>
    My Ajax call is copied from w3schools, and shouldn't be a problem. I also used the ajax function in jquery and the same problem.

    BTW I am using windows XP and IE, running xampp as my webserver and sql on localhost.

    If anyone can give me some advise it would be greatly appreciated!

    Thanks,

    Tom
    Last edited by qmqmqm; 03-10-2009 at 09:19 PM.

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Sounds like you are probably cached.

    Code:
    xmlhttp.open("GET", theURL ,true);
    xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
    xmlhttp.send();
    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • The Following 2 Users Say Thank You to A1ien51 For This Useful Post:

    oesxyl (03-13-2009), qmqmqm (03-17-2009)


  •  

    Posting Permissions

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