问题:在对话框中显示jquery flot图
我有一个使用flot显示水平条形图的页面,这是交互式的。当我点击任何一个条时,它会执行getJSON,并通过传递的变量在外部php页面中绘制另一个图。我正试图在jquery对话框中显示的外部php页面中绘制图形。
我到处找,但找不到解决办法。感谢您的帮助。
$.getJSON("page2.php?"+data, function(mdata) {
$('<div></div>').html(result).dialog({
autoOpen: false,
modal: true,
title: 'Page Hits - Monthly',
width: 450, height: 300
}).dialog('open');
第2页是绘制图形的地方,我想在对话框中的当前页面中显示图形。
可能尝试$.get
而不是$.getJSON
$.get('page2.php?'+data, function(response){
$('<div></div>').html(response).dialog({
autoOpen: true,
modal: true,
title: 'Page Hits - Monthly',
width: 450, height: 300
});
});
您只需创建一个PHP类来包含数据,将图形数据存储在该类的实例中,然后将对象作为发布数据传递到对话框或弹出窗口。
然后可以创建一个方法来处理自定义数据并相应地绘制图形。