[英]PHP How to edit HTML element Content?
Just like $('#elementid').html('html code');
就像$('#elementid').html('html code');
but in PHP. 但在PHP中。 Is there a way to change live content with PHP without reloading page? 有没有一种方法可以使用PHP更改实时内容而无需重新加载页面? Tried 试过了
<?php
echo '<script type="text/javascript">
$('#element').html('<p>I am a text</p>');
</script>'
?>
<div id='element'>I will be changed!</div>
Is there any shorter way, that one also not works everytime. 有没有更短的方法,那就不是每次都可行。
$.post('test.php','',function(response){
$('#element').html(res);
});
test.php test.php
$name = "sham";
echo "this is my variable $name";
Output of Html HTML的输出
<div id='element'>this is my variable sham</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.