Results 1 to 1 of 1

Thread: Dynamic Ajax Content :: loadobjs doesn't seem to work

  1. #1
    Join Date
    May 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Dynamic Ajax Content :: loadobjs doesn't seem to work

    1) Script Title: Dynamic Ajax Content

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...jaxcontent.htm

    3) Describe problem: This is a problem I've had for some time. I'm using a Ajax /php model but when loading pages .js files are not "linked / initialized". I thought the loadobjs() would fix that.

    the code in menu:
    PHP Code:
    <?php
        
    if ($userID == 1){
            echo 
    "<button class='Menu' onclick=\"ChangeMain('Pg_People.php', 'HumanResources.js')\" value=\"People\">Clients</button><br/>";
            echo 
    "<button class='Menu' onclick=\"ChangeMain('Pg_Companies.php', 'HumanResources.js')\" value=\"Cos\">Companies</button><br/>";
            echo 
    "<button class='Menu' onclick=\"ajaxpage('Pg_Cases.php', 'Main'); loadobjs('./Code/Cases.js')\" value=\"Cases\">Cases</button><br/><br/>";
            echo 
    "<button class='Menu' onclick=\"ChangeMain('Pg_Test.php', 'Cases.js')\" value=\"Cos\">Test 1</button><br/>";
            echo 
    "<button class='Menu' onclick=\"ajaxpage('Pg_Test.php', 'Main'); loadobjs('./Code/Cases.js')\" value=\"Cases\">Test 2</button><br/><br/>";        
        }
    ?>
    the "ChangeMain" routine was an earlier version but I'd like to keep it. It consists of:
    Code:
    function ChangeMain(NewMain, jsfile){
      xmlHttp=GetXmlHttpObject()
      if (xmlHttp==null){
        alert ("Browser does not support HTTP Request")
        return
      } 
      try{
    		ajaxpage(NewMain, 'Main');
    	  loadobjs(jsfile); 
      }
      catch(err){
        alert("Error: "+err.description)
      }    
    }
    The external page calls a function (from a button) that runs a js "alert()"

    The "ajaxpage()" function works perfectly. "loadobjs()" doesn't seem to do anything.
    Pg_Test.php looks like this:

    HTML Code:
    <?php
    /*
     * Created on May 27, 2009
     *
     */
     session_start();
    ?>
    <html>
    <head>
    </head>
    <body >
    <div id='CaseOverview'>
    <form>
     	<input type="button" id='AdvFilter'  value="Test Load"  onclick="TestCaseLoad()" align="center"/>
    </form>
    </div>
    </body>
    </html>
    And finally Cases.js looks like this:
    Code:
    funtion TestCaseLoad(){
    	alert("Cases.js is loaded")
    }
    I'm at a loss at to why it doesn't work. Anyting you can offer is greatly appreciated !!




    Sorry I'm a moron. Missed typed. function!!
    Last edited by JohnDMcQ; 05-27-2009 at 06:51 PM. Reason: Fixed

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •