這是我的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"
「needtogetcontent.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;
});
我們不是做你的工作適合你。顯示你所寫的任何代碼來嘗試這個,我們將盡力幫助解決它。但在此之前,這只是「給我編碼」 –
對不起,如果我的問題讓別人誤解。我的英語不好,所以我很抱歉! 沒有發佈我的真實代碼的原因是爲了讓每件事情都清楚。請原諒我,如果我讓一些瘋狂的男人!:D –