469,326 Members | 1,600 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,326 developers. It's quick & easy.

ajax-externalhtml-div issues

Hi, im trying to do some experimental ajax/javascript/dhtml work
based on a dynamic drive tutorial.

http://www.dynamicdrive.com/dynamici...tent.htm#combo

my problem is that i cannot find ANY information ANYWHERE AT ALL
on how to select a <div> from the EXTERNAL html page beingloaded.

basically i dont want to load an entire page. i only want to load specified
<div>s into other div containers.

can anyone help me?

I have narrowed it down to the following pieces of code:

function loadpage(page_request, containerid, originid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=pag e_request.responseText
}

the LAST line document.getElementById(containerid) works and publishes
the entire html page (external.htm) into containerid in the index.htm page

BUT whenever i try to add ANY code to:

innerHTML=page_request.responseText
such as
innerHTML=page_request.getElementById(originid).re sponseText
or
innerHTML=page_request.responseText.getElementById (originid)
or
innerHTML.getElementById(originid)=page_request.re sponseText

NOTHING WORKS!!!

i'd be super appreciateive of anyone who might be able to guide me as to how to format my syntax so this can be done.

I know my originid and containerid variables are passing b/c i alerted them and they DEFINITELY work. it just has to do with the fact that i cant find any documentation on the proper way to do this (internet and like 4 books today scoured!)

thanks in advance to anyone out there

mk
Reply With Quote
Jun 6 '07 #1
3 1541
acoder
16,027 Expert Mod 8TB
Hi, im trying to do some experimental ajax/javascript/dhtml work
based on a dynamic drive tutorial.

http://www.dynamicdrive.com/dynamici...tent.htm#combo

my problem is that i cannot find ANY information ANYWHERE AT ALL
on how to select a <div> from the EXTERNAL html page beingloaded.

basically i dont want to load an entire page. i only want to load specified
<div>s into other div containers.

can anyone help me?

I have narrowed it down to the following pieces of code:

function loadpage(page_request, containerid, originid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=pag e_request.responseText
}

the LAST line document.getElementById(containerid) works and publishes
the entire html page (external.htm) into containerid in the index.htm page

BUT whenever i try to add ANY code to:

innerHTML=page_request.responseText
such as
innerHTML=page_request.getElementById(originid).re sponseText
or
innerHTML=page_request.responseText.getElementById (originid)
or
innerHTML.getElementById(originid)=page_request.re sponseText

NOTHING WORKS!!!

i'd be super appreciateive of anyone who might be able to guide me as to how to format my syntax so this can be done.

I know my originid and containerid variables are passing b/c i alerted them and they DEFINITELY work. it just has to do with the fact that i cant find any documentation on the proper way to do this (internet and like 4 books today scoured!)

thanks in advance to anyone out there

mk
Reply With Quote
That's the incorrect syntax. What you probably want to do is parse responseText for the information that you want and then set the innerHTML to the parsed data.

Show an example of data/div that you want from a page.
Jun 6 '07 #2
that's the problem. im such a newbie im not even sure how to start going about this.

can you possibly point me in the correct direction
as in how to start parsing that data properly in ajax/js?

im mostly a flash programmer and thisi s my first hardcore ajax/js dealyo.

thanks also for helping me at least know what i need to look into for a solution.

:) mk
Jun 8 '07 #3
acoder
16,027 Expert Mod 8TB
See this example.

If you get stuck, post your code.
Jun 9 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

11 posts views Thread by Yarco | last post: by
10 posts views Thread by Steve | last post: by
7 posts views Thread by Thirsty Traveler | last post: by
reply views Thread by melledge | last post: by
10 posts views Thread by =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= | last post: by
2 posts views Thread by soni2926 | last post: by
6 posts views Thread by Scott M. | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.