这是我的html页面:
<body>
<div id="containt">
<p>already have containt.</p>
</div>
<div id="other">
<form id="test">
<input id="sth" name="sth" value="123456"/>
<div id="submit"></div>
</form>
</div>
<body>
和我的 php 脚本:“abc.php”
$happy['verymuch'] = $_POST['sth'];
include('needtogetcontent.php');//and then use extract() to extract $verymuch in "needtogetcontent.php"
“需要获取内容.php”
<a href="<?=$verymuch?>"><?=$verymuch?></a>
现在我需要制作这样的html页面:
<body>
<div id="containt">
<p>already have containt.</p>
</div>
<div id="other">
<a href="123456">123456</a>
</div>
<body>
感谢您的帮助:D!
更新:我用过
$('#submit').click(function() {
$.ajax({
url: 'abc.php',
type: 'POST',
data: $('#test').serialize(),
success: function(data){
//data will return anything echo/printed to the page.
//based on your example, it's whatever $happy is.
$('#other').text(data);
}
});
return false;
});