在本地主机上移动后,AJAX无法正常工作 [英] AJAX is not working properly after moving on localhost

查看:71
本文介绍了在本地主机上移动后,AJAX无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的简单测试代码有问题.远程服务器上的一切都很好,它在我移至localhost(xampp)

时启动

我有一个页面:

http://localhost/test/test.php

称为 http://localhost/test/ajax.php 包含:

我想浏览器中的结果应该是:"heh?WTF",但仅仅是"heh?".任何想法出什么事了吗? 请告诉我, 谢谢, 米哈尔

解决方案

您是否尝试过:

echo $_REQUEST['variable'];

?

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

解决方案

Have you tried:

echo $_REQUEST['variable'];

?

这篇关于在本地主机上移动后,AJAX无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆