我必须从数据库中获取数据,并且对于每条记录我想显示不同的对话框。我尝试了下面的代码但没有工作......我需要动态创建吗?
我的代码中缺少什么?
$.getJSON("jsonfile.php", function(json){
$.each(json, function (key, val) {
$.each(val, function (key, val1) {
if(key=='rem_doc_deal_ref')
{
$('#rem_doc_deal_ref').text(val1);
}
$( "#dialog_rem_doc" ).dialog({
buttons: {
"Ok!": function() {
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
});
});
});
这是我的 JSON
[{"id":"27","rem_doc_deal_ref":"RH-D-139"},{"id":"43","rem_doc_deal_ref":"RH-D-140"},{"id":"41","rem_doc_deal_ref":"RH-D-144"},{"id":"55","rem_doc_deal_ref":"RH-D-157"},{"id":"33","rem_doc_deal_ref":"RH-D-158"},{"id":"22","rem_doc_deal_ref":"RH-D-233"}}
这是我的 HTML
<div id="dialog_rem_doc" title="Reminder Alert" style="display:none;">
<span id="rem_doc_deal_ref"></span>
</div>