I have an issue with my simple testing code. Everything was fine on remote server, it starts when I moved to localhost(xampp)
I have 开发者_开发技巧a page:
http://localhost/test/test.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>NeedNext - Try It</title>
<script type="text/javascript" src="javascript/jquery.js" ></script>
<script type="text/javascript">
$().ready(function() {
$("#listinx").load("ajax.php",{variable : "WTF"})
});
</script>
</head>
<body>
<div id="listinx"></div>
</body>
</html>
called http://localhost/test/ajax.php contains:
<?php
echo "heh?";
echo $variable;
?>
I suppose the result in browser should be: "heh?WTF" but it's only "heh?". Any ideas what's wrong? Please let me know, Thanks, Michal
You don't have register_globals enabled.
Therefore, you cannot implicitly get POST parameters by writing $variable
.
Change your code to echo $_POST['variable']
.
You should also disable it on your server:
Warning
This feature has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.
It will usually create security holes.
Have you tried:
echo $_REQUEST['variable'];
?
精彩评论