Member Avatar for TechySafi
<script language = "javascript">
      var XMLHttpRequestObject = false;

      if (window.XMLHttpRequest) {
        XMLHttpRequestObject = new XMLHttpRequest();
      } else if (window.ActiveXObject) {
        XMLHttpRequestObject = new
          ActiveXObject("Microsoft.XMLHTTP");
      }

        function getData(dataSource, divID, data)
{
  if(XMLHttpRequestObject) {
    var obj = document.getElementById(divID);
    XMLHttpRequestObject.open("POST", dataSource);
    XMLHttpRequestObject.setRequestHeader('Content-Type',
      'application/x-www-form-urlencoded');

    XMLHttpRequestObject.onreadystatechange = function()
    {
      if (XMLHttpRequestObject.readyState == 4 &&
         XMLHttpRequestObject.status == 200) {
           obj.innerHTML =
             XMLHttpRequestObject.responseText;
      }

          }
            XMLHttpRequestObject.send("data=" + data);

          }
      }
    </script>

and i call the function like this,

<a class="" href="#" onclick = "getData('loader.php', 'content', '1')" >Dictionary Administration</a></li> 
    <li><a class="" href="#" onclick = "getData('loader.php', 'content', '2')">Operators Administration</a></li> 
    <li><a class="" href="#" onclick = "getData('loader.php', 'content', '3')">Stats</a></li>

and here is loader.php

<?php
  if($_POST['data']==1)
  {
      echo ".::Dictionary Administration::. <br /> <br />";
      ?>
      <form action="#" method="post">
        Setup New Dictionary: <input type="text" name="name" /> <input type="submit" name="submit" value="Go" /> 
      </form>
 <?php     
  }
  elseif($_POST['data']==2)
  {
      echo "Operators Administration";
  }
  else
  {
      echo "Stats";
  }
?>

works good but when I want to use a form inside a tab, i can not. because when i hit submit button, the targetdiv no longer loading from loader.php rather i goes to primary state.

a relevant example example would be good? well, we can browse home,mention on twitter without refreshing the whole page. now imagine im on mention page, now if i click on a mention, it expands. how is it works? why does not it goes to primary state (that is home i think)

Member Avatar for diafol

>works good but when I want to use a form inside a tab, i can not. because when i hit submit button, the targetdiv no longer loading from loader.php rather i goes to primary state.

a relevant example example would be good? well, we can browse home,mention on twitter without refreshing the whole page. now imagine im on mention page, now if i click on a mention, it expands. how is it works? why does not it goes to primary state (that is home i think)

I can't make head nor tail of that. How about rephrasing it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.