Search code examples
javascriptphpjquery-easyui

How to make easyui panel in easyui layout with php


In my project, I use easyui.

At first, easyui-layout cenDiv has default content.

And then I want to fetch content from server DB througth oat.php with corAnnouncement button.

The default content of cenDiv will be replaced by a panel content from oat.php.

But unfortuately, It works fail.

Here is js code:

function corpAnn()
{
 var oaAnn="tp";
 $.ajax({
        dataType:'html',
        type:"POST",
        url:"oat.php",
        data: {oaAnn:oaAnn},
        success:function(data)
        {
          $('#cenDiv').html(data);
        }
      });       
}

Here is html code:

<a href="javascript:void(0)" class="easyui-linkbutton" onclick="corpAnn()">corAnnouncement</a><br />
 <div id="cenDiv" class="easyui-layout" style="position:static;height:100%" data-options="region:'center',title:''">
 ......
 </div>

Here is oat.php code:

if(isset($_POST['oaAnn']))
{
    ......
   echo '<div class="easyui-panel"  closed="true" title="Panel Footer" style="width:700px;height:200px;" data-options="footer:'#ft'">';
   echo '<table border=1px cellspacing=0 align="center" size="100%">';
   ......

 }

I have found that

   data-options="footer:'#ft'";

is wrong, because echo has single quotation marks.

I have tried:

data-options=footer:'"#ft"' ;

and

 data-options=footer:"#ft";

But they works fail. Who can help me?


Solution

  • echo '<div class="easyui-panel"  closed="true" title="Panel Footer" style="width:700px;height:200px;" data-options="footer:\'#ft\'">';
    

    I forgot escape character.Maybe I am tired.