在我的按钮点击我有一个弹出的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