我有一個從ajax請求返回的數據有問題。基本上,當我點擊一個鏈接時,它會運行一個ajax請求,將一些html加載到div中,該部分工作正常,數據加載完成後問題就來了。jQuery ajax鏈接,返回的數據包括從不會提交
加載的html的一部分是一種形式,這種形式工作正常,如果我直接加載頁面,但當它通過ajax加載到div它不會提交,但其餘的鏈接在html工作正常。
這裏是請求遠程HTML數據代碼:
// Ajax to load image editing page
$('a.editpicture').click(function(e) {
e.preventDefault();
var picture = $(this).attr("id")
$.ajax({
url: 'http://localhost/digital-xposure/index.php/members/viewpicture/' + picture,
success: function(data) {
$('#update-picture').html(data);
}
});
});
這是它加載的形式:
<form method="post" id="updatepicture" name="updatepicture" action="http://localhost/digital-xposure/index.php/members/editpicture"/>
<p>Title<input type="text" name="title" id="title" style="input" value="<?php echo $title; ?>"></P>
<p>Album<?php echo $albums;?></p>
<p>Description<textarea name="description" id="description" cols="50" rows="5"><?php echo $description; ?></textarea></P>
<input type="hidden" name="filename" id="filename" value="<?php echo $filename; ?>" />
<input type="button" name="update-submit" id="update-submit" value="Update details" class="button"> Or <input type="button" onClick="location.href='<?php echo base_url(); ?>index.php/members/deletepicture/<?php echo $filename; ?>'" value="Delete picture" class="button">
</form>
任何想法,爲什麼表單後不會提交被加載到DIV?任何幫助非常感謝,謝謝。
Calum
你有鏈接? – Grumpy 2010-03-25 20:51:35
沒有頁面錯誤? – 2010-03-25 20:59:01
沒有頁面錯誤,請求的html中的表單只是不提交。 – calumogg 2010-03-25 22:48:14