...

View Full Version : problem: ajax call v.s. opening page directly



qmqmqm
03-10-2009, 09:13 PM
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?


<?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

A1ien51
03-12-2009, 03:27 PM
Sounds like you are probably cached.


xmlhttp.open("GET", theURL ,true);
xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
xmlhttp.send();

Eric



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum