在我的按鈕點擊我有一個彈出的div和內,我需要表現出與JSON格式獲取JSON數據並顯示在DIV
<a href='somelink' title='hello'class='details' rel='id'>h1</a>
我彈出的div作爲數據返回的div如下
<div id="popupdiv">
</div>
<script type="text/javascript">
$(".details").live("click", function() {
var id = $(this).attr("rel");
$('#popupdiv').modal();
$.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
url: "/mycontroller/details?Id="+ id,
data: "",
dataType: "json",
success: function (data) { //which contains name,email etc how can i append the details on to the "popupdiv" div by inserting in to another div
}
});
return false;
});
</script>
你有什麼問題?使用如:alert(data.name); – Hadas 2012-02-07 12:08:03
json是怎麼樣的 – Rafay 2012-02-07 12:10:53
沒有顯示alert frnd我需要填寫名稱等等到一個div然後將其添加到父div – 2012-02-07 12:12:57