I have reduced my problem to the following 2 scripts. php1.php has 2 buttons -- the first makes an ajax GET request to php2.php expecting "(GETq=abcGETdef)" and the second makes an ajax POST request to php2.php expecting "(POSTq=abcPOSTdef)".
Using the URL http://localhost/php1.php:
I get the expected results: "(GETq=abcGETdef)" or "(POSTq=abcPOSTdef)"
Using the F2 preview gives the URL http://localhost:89/~X/php1.php:
I get "(GETq=abcGETdef)" (correct) for the GET button, but
I get "(POSTq=abcP)(GETq=abcPOSTdef)" (wrong) for the POST button.
This only happens when I edit my scripts using the X: drive.
1) my webroot is "C:/xampp/htdocs"
2) X: is defined to be "C:/xampp/htdocs" in a boot .bat file
"subst X: C:/xampp/htdocs"
There is no problem when I edit my scripts using the C: drive.
The "subst X: C:/xampp/htdocs" works fine for all other uses.
Thanks for your product.
php1.php:
- Code: Select all
<script type="text/javascript">
function doajaxget() {
var oReq = new XMLHttpRequest();
oReq.onload = function() { alert(oReq.responseText); }
oReq.open("get", "php2.php?q=abcGETdef", true);
oReq.send();
}
function doajaxpost() {
var oReq = new XMLHttpRequest();
oReq.onload = function() { alert(oReq.responseText); }
oReq.open("post", "php2.php", true);
oReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
oReq.send("q=abcPOSTdef");
}
</script>
<body>
<button type="button" onclick="doajaxget();">ajaxGET</button>
<button type="button" onclick="doajaxpost();">ajaxPOST</button>
</body>
</html>
php2.php:
- Code: Select all
<?php
$ret = "";
if (isset($_POST['q'])) $ret .= "(POSTq=" . $_POST['q'] . ")";
if (isset($_GET['q'])) $ret .= "(GETq=" . $_GET['q'] . ")";
if ($ret == "") $ret = "none";
echo $ret;
?>