title: Refresh a div in joomla 3.x view
body: <p>For my component i made pre flight check page that does a lot of checking, but i don't want that checks are running at the beginning, and some times i just want check to be run.</p>
  
  <p>So i that i use ajax, but that is not sollution i lose alle my classes from the joomla framework, is there better way to approce this? </p>
  
  <p>my tmpl/default.php looks like this:</p>
  
  <pre><code>&lt;div id="j-sidebar-container" class="span2"&gt;
      &lt;?php echo $this-&gt;sidebar; ?&gt;
      &lt;button onClick="xmlserverinfo()"&gt;XMLserver check&lt;/button&gt;
  &lt;/div&gt;
  &lt;div id="j-main-container" class="span10"&gt;
      &lt;?php
  
          // some php stuff to get the variables
  
      ?&gt;
      &lt;div id="preflight"&gt;
          &lt;table&gt;
              &lt;tbody&gt;
                  &lt;tr&gt;
                      &lt;td&gt;
                          &lt;table&gt;
                              &lt;tbody&gt;
                                  &lt;tr&gt;
                                      &lt;td colspan="3"&gt;XML server status&lt;/td&gt;
                                  &lt;/tr&gt;
                                  &lt;tr&gt;
                                      &lt;td&gt;Naam&lt;/td&gt;
                                      &lt;td&gt;Url&lt;/td&gt;
  
                                      &lt;?php if ($proxy == '1')
                                          {
                                              echo "&lt;td&gt;via proxy&lt;/td&gt;";
                                          }?&gt;
                                          &lt;td&gt;Status&lt;/td&gt;
                                  &lt;/tr&gt;
                                  &lt;div id="xmlservers"&gt;&lt;/div&gt;
                              &lt;/tbody&gt;
  &lt;snip&gt;
  </code></pre>
  
  <p>This is the java script i use to refresh my div include ajax.js</p>
  
  <pre><code>function xmlserverinfo() 
  {
      var xmlhttp;
      if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
          xmlhttp=new XMLHttpRequest();
      }
      else
      {// code for IE6, IE5
          xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      xmlhttp.onreadystatechange=function()
      {
          if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)
          {
              document.getElementById("xmlservers").innerHTML=xmlhttp.responseText;
          }
      }
      xmlhttp.open("GET","components/com_hccxmlbeheer/views/preflightcheck/tmpl/xmlservers.php",true);
      xmlhttp.send();
  }
  </code></pre>
  
  <p>This is the xmlservers.php that builds my table and thats what i want in my div:</p>
  
  <pre><code>&lt;?php
      /**
          * @package     Joomla.Administrator
          * @subpackage  com_hccxmlbeheer
          *
          * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
          * @license     GNU General Public License version 2 or later; see LICENSE.txt
      */
  
      // No direct access to this file
      defined('_JEXEC') or die;
      // php stuff to get variables 
  
  
  
  foreach ($xmlservers as $xmlserver)
     {
      echo "&lt;tr&gt;";
      echo "&lt;td&gt;$xmlserver[0]&lt;/td&gt;";
      echo "&lt;td&gt;$xmlserver[1]&lt;/td&gt;";
      if ($proxy == '1')
      {
       echo "&lt;td&gt;ja&lt;/td&gt;";
      }
      $echotest = HCC::echo_test($xmlserver[1], $pluginnaam, $plugincat, '0');
      if ($echotest['Status'] == 'TRUE')
      {
       echo "&lt;td bgcolor=\"green\"&gt;Oke&lt;/td&gt;";
      }
      else
      {
        echo "&lt;td bgcolor=\"red\"&gt;mislukt&lt;/td&gt;";
      }
       echo "&lt;/tr&gt;";
      }
      if ($proxy == '1')
      {
       foreach ($xmlservers as $xmlserver)
          {
           echo "&lt;tr&gt;";
           echo "&lt;td&gt;$xmlserver[0]&lt;/td&gt;";
           echo "&lt;td&gt;$xmlserver[1]&lt;/td&gt;";
           if ($proxy == '1')
              {
                  echo "&lt;td&gt;nee&lt;/td&gt;";
              }
              $echotest = HCC::echo_test($xmlserver[1], $pluginnaam, $plugincat, '1');
              if ($echotest['Status'] == 'TRUE')
              {
               echo "&lt;td&gt;Oke&lt;/td&gt;";
              }
              else
              {
               echo "&lt;td&gt;mislukt&lt;/td&gt;";
              }
              echo "&lt;/tr&gt;";
              }
              }
          ?&gt;
  </code></pre>
  
  <p>WHat am i doing wrong ?</p>