[jQuery] Re: AJAX GetElementByID problem

2007-09-01 Thread happycfer

Hi,
 
I see the fix - you are using the latest version of jquery (1.1.4). I was using 
1.1.3.1 .  When I started using the latest version your code suggestions 
started working!  I appreciate the help with loader code too, that worked 
great!  I tested on FF (pc/mac), ie 
 
Thanks again for all of your help,
 
-Kevin
 
 From: [EMAIL PROTECTED] To: jquery-en@googlegroups.com Subject: [jQuery] 
 Re: AJAX GetElementByID problem Date: Sat, 1 Sep 2007 00:08:22 -0700
  On Aug 31, 6:38 pm, [EMAIL PROTECTED] wrote:   as you suggested and 
 while it does run the alert message, it  still fails out on the 
 document.getElementByID in the destination  page with the same error: 
 TypeError: document.getElementById(blah1)  has no properties   Would 
 you be able to paste in your sample app that you created? I  am probably 
 missing something small.  html head titleBlah Blah/title  
 style body { margin-left: 5%; margin-right: 5%; color: crimson; 
 background:#1C1C1C; }  #ajaxLoader { text-align: center; border: 1px 
 solid silver; color: yellow; background: green; float: right; } 
 /style  script type='text/javascript' 
 src=/public/js/jquery-1.1.4.js/ script  /head body  
 h3Kevin's Blah Test/h3  div id=destDiv1 script 
 language=JavaScript var s = ; s += div id='ajaxLoader'; s += 
 img src='/public/js/loader.gif' alt='Loading...' / s += /div; 
 $(#destDiv1).html(s);  $.ajax({ url: '/public/blah1.htm?a=' + 
 Math.random(), type: 'GET', dataType: 'html', timeout: 6, error: 
 function(a,b,c){ $(#destDiv1).html('Error loading channel' + a + | + b 
 + | + c); }, success: function(thehtml){ // do something with HTML 
 $(#destDiv1).html(thehtml); } });  /script /div  /body 
 /html  Note:  The blah1.htm has this:  div id=blah1/div 
 script language=JavaScript alert(hi); 
 document.getElementById(blah1).innerHTML = stronghi/strong; 
 /script  Other than clean up code, making easier to read, adding my 
 loader.gif plus style, it is pretty much the same code but use jQuery to add 
 the html() so that any script tags are executed.  If the problem persist, 
 then you might want to describe the browser you are testing it with. I 
 tested the above with IE and FF.  Hope this helps   PS: It was ajaxing 
 so fast with my local server, to see the loader in action, what I did was 
 wrap the $.ajax() in a timer like so:  setTimeout(function () {  .. the 
 above ajax statement ..  },3000);  -- HLS 
_
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=createwx_url=/friends.aspxmkt=en-us

[jQuery] Re: AJAX GetElementByID problem

2007-08-30 Thread happycfer

Hi Glenn,

If you are asking where the script to include the js for jquery is, it is 
located within the head tag of the first page.  my jquery js file (v 1.1.3.1 
btw) is located in the folder as both the source page and the page retrieved.

Does this answer your question?

-Kevin


Date: Wed, 29 Aug 2007 10:52:16 -0700
From: [EMAIL PROTECTED]
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: AJAX GetElementByID problem

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: 6,
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 = stronghi/strong;
/script

This throws the error: TypeError: 
document.getElementById(blah1) has
no properties

Any ideas?

Thanks!

-Kevin




_
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+worldmkt=en-USform=QBRE