[英]how can I set the content of a html element via javascript (jquery) to php include file
how can I set the content of a html element via javascript (jquery) to php include file I mean something like 如何通过javascript(jquery)将html元素的内容设置为php include文件我的意思是
$('#loadTest').append(' <?php include_once "test.php"; ?>');
I also tried load 我也试过加载
$('#loadTest').load('test.php',function(){
alert("loaded!!")
});
But it doesn't work :'( 但它不起作用:'(
You have to use AJAX: 你必须使用AJAX:
$.get('test.php', function(data) {
$('#loadTest').append(data);
});
The code has to be executed on the server, and the output is returned to you. 代码必须在服务器上执行,输出将返回给您。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.