0
我提前为我的(可能)愚蠢的问题,但我的JavaScript/JQuery的知识道歉几乎是0包括负载脚本PHP变量
我在index.html中的以下脚本:
index.html的
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#MyDIV")
.load("buttons.php")
});
</script>
<div id="MyDIV"></div>
正如你所看到的,这个想法是负载buttons.php在div标签中的index.html - 那窝KS精 -
buttons.php
<div id="buttom">
<div id="botton5"><a href="#"><img src="5.png" id="5"/></a></div>
</div>
<script>
$('#botton5').click(function(event){
$("#bottons").load('somepage.php?answer=5'); //here!
});
</script>
那也工作正常我从somepage.php接收到的信息中MyDIV index.html中
,但不工作的时候我在该行的URL中包含一个php
$("#bottons").load('somepage.php?answer=5&title=<?php echo $title;?>&date=<?php echo $date;?>'); //here!
包括一个PHP载入,div不会在index.html中加载,你能否支持我如何在加载的URL中添加一个php?
预先感谢您的支持
既然你从JavaScript调用'somepage.php'你不能使用出于传递参数进行urlencode和urldecode使用PHP有 – modsfabio
大教堂不直接与PHP代码 – prasanth
你试图使用它们之前定义'$ title'和'$ date'支持? – Qirel