title: Dialog Box with Views in it - CakePHP
body: <p>I have a simple dialog box that pops up when I hit a sample link button on my page.  What I want to do is change the onclick jquery function from the link to one of my buttons in my table.  The buttons currently direct the web browser to a new page, but I want them to open the dailog box with thier corresponding view file in it.  I am using CakePHP 2.x.
  I looked into using href but Im not sure how to go about that.</p>
  
  <p>Here is the code for my index.ctp file where the buttons are located.</p>
  
  <pre><code>&lt;link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/start/jquery-ui.css" type="text/css" media="all" /&gt;
  
  &lt;a href="#"&gt;link&lt;/a&gt;   &lt;!-- this is to test if the dialog box works --&gt;
  &lt;div id="dialog"&gt;&lt;/div&gt;
  
  &lt;script&gt;
  var p = '&lt;p&gt;test test test test test test&lt;/p&gt;';
  $('#viewButton').click(function()
  {
  //  $(location).attr('href', 'view.ctp');  // not sure if this line of code is on the right track or not
      $(p).dialog(
      {
          width: 400,
          height: 400,
          modal: true,
          resizable: true,
          buttons:{
              OK: function(){
                  $(this).dialog("close");}}
      });
  })
  &lt;/script&gt;
  
  &lt;p&gt;&lt;marquee&gt;&lt;u&gt;Local Clocks&lt;/u&gt;&lt;/marquee&gt;&lt;/p&gt;
  
  &lt;table&gt;
      &lt;thead&gt;&lt;tr&gt;
          &lt;th&gt;Id&lt;/th&gt;
          &lt;th&gt;Name&lt;/th&gt;
          &lt;th&gt;Actions&lt;/th&gt;
      &lt;/tr&gt;&lt;/thead&gt;
  &lt;tbody&gt;
  
  &lt;?php 
  foreach($localClocks as $LocalClock) { ?&gt;
  
  &lt;tr&gt;
      &lt;!-- &lt;td&gt;&lt;?php //echo $LocalClock['LocalClock']['id']; ?&gt;&lt;/td&gt; --&gt;
      &lt;td&gt;&lt;?php echo $this-&gt;Html-&gt;link($LocalClock['LocalClock']['id'], array('controller'=&gt;'localClocks', 
      'action'=&gt;'view', $LocalClock['LocalClock']['id'])); ?&gt;&lt;/td&gt; 
  
      &lt;td&gt;&lt;?php echo $LocalClock['LocalClock']['name']; ?&gt;&lt;/td&gt;
  
  &lt;td&gt;&lt;input type="button" class="viewButton" value="View" onclick="location.href='&lt;?php echo $this-&gt;Html-&gt;url(array('controller' =&gt; 'localClocks', 'action' =&gt; 'view', $LocalClock['LocalClock']['id'])); ?&gt;';"/&gt;
  &lt;input type="button" class="editButton" value="Edit" onclick="location.href='&lt;?php echo $this-&gt;Html-&gt;url(array('controller' =&gt; 'localClocks', 'action' =&gt; 'edit', $LocalClock['LocalClock']['id'])); ?&gt;';"/&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;?php } ?&gt;
  
  &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I need help with switching the button onclick events to opening the dialog box and have the dialog box display the respective View pages.</p>
  
  <p>Thanks in advance</p>