【发布时间】:2012-08-07 19:23:53
【问题描述】:
我正在尝试仅重新加载特定的 div
$("#captcha").html('<?php echo 'abc';?>'); // just as test - works well
因为div内容比较大,我试了一下:
$("#captcha").html('<?php include 'myFile.php';?>'); // doesn't work
如何将 .php 文件中的代码调用到 div 中?
【问题讨论】:
-
试试
.html("<?php include 'myFile.php'; ?>"); -
你得到了什么结果?
-
错误是什么?你的
JavaScript代码在哪里? (即单独的.js文件/内联) -
我认为您在谈论 ajax。你可能需要
.load()和完整的网址。 -
@Austin 对不起,应该说“确保你在你的 php 输出中转义任何 's”
标签: php javascript jquery include