Where is the jQuery?

Glen

On 8/29/07, Kevin <[EMAIL PROTECTED]> wrote:
>
>
> Hi All,
>
> I'm trying to use an ajax call to call a 2nd page which uses a
> getElementByID to set a div's content on that page.  If I just try to
> call the 2nd page, I get a js error that I can't run the
> getElementByID because it has no properties.  If I change the 2nd page
> to be a callback function and call that via the callback function of
> jquery it works fine, so it sounds like an order of operations problem
> here.  Is there anyway to allow getElementByIDs without forcing them
> in a callback function?
>
> Here is my ajax call:
> <div id="destDiv1">
>         <script language="JavaScript">
>         document.getElementById("destDiv1").innerHTML = "<div
> align=\"center
> \"><img src=\"/ajax/ajax-loader.gif\" alt=\"Loading...\" /></div>";
>         $.ajax({
>             url: 'j1.html?a=' + Math.random(),
>             type: 'GET', dataType: 'html', timeout: 60000,
>             error: function(a,b,c){
>                         document.getElementById("destDiv1").innerHTML =
> 'Error loading
> channel' + a + "|" + b + "|" + c;
>             },
>             success: function(thehtml){
>                 // do something with HTML
>                         document.getElementById("destDiv1").innerHTML =
> thehtml;
>             }
>         });
>         </script>
> </div>
>
> Now the page to be loaded:
>
> <div id="blah1"></div>
> <script language="JavaScript">
> alert("hi");
> document.getElementById("blah1").innerHTML = "<strong>hi</strong>";
> </script>
>
> This throws the error: TypeError: document.getElementById("blah1") has
> no properties
>
> Any ideas?
>
> Thanks!
>
> -Kevin
>
>

Reply via email to