Jqplot图形仅在第一次提交时出现

| 单击按钮后,我将执行以下jQuery代码
$(\'#substat\').click(function() { 
    $.post(\'ext/engine.php\', post, function(data){
        $(\'#statout\').empty().append(data).dialog(
         {height:350, width:700, dialogClass: \'shadowme\', position: \'center\'})
        }); 
});
更新-我已经按代码检查了代码,以查看问题所在。看起来是PHP部分,如下所示:
$html = \'<script>\';
for($s = 0; $s < $m; $s++) {
    if ($m-$s != 1) { $var1 .= $out[total][$s].\', \'; $var2 .= $out[age][$s].\'\", \"\'; }
    else { $var1 .= $out[total][$s]; $var2 .= $out[age][$s].\'\"\';}
    if ($out[total][$s] > $max) { $max = $out[total][$s]; }
}
if ($max > 10) { $max = round($max/10); }
$html .= \'VarH = [\'.$var1.\'];
    plot1 = $.jqplot(\"statout\", [VarH], {
                legend:{show:true, location:\"ne\"},
                title:\"Gente\",
                series:[ { label:\"VarH\", renderer:$.jqplot.BarRenderer } ],
                axes:{
                    xaxis:{ renderer:$.jqplot.CategoryAxisRenderer, ticks:[\'.$var2.\'] },
                    yaxis:{ min:0, tickInterval:\'.$max.\', autoscale: true }
                },
                seriesDefaults:{ lineWidth:5, rendererOptions: { barWidth:5, barMargin:5, barPadding:0 } }
            });
    </script>\';
echo $html;
如果我更改echo $ html的最后一行;回声“你好”;它将始终有效。 但是,如果我将其保留在使用jqplot创建的$ html变量中,则在jquery对话框中呈现时将只工作一次。之后,我必须刷新网页以使其重新工作,而不是再次单击提交按钮以创建带有图形的对话框。     
已邀请:
        我有同样的问题。解决方案是先显示对话框,然后再将(!)装入图表。     

要回复问题请先登录注册