PDA

View Full Version : Help With Dynamic Ajax content



nurses
01-18-2006, 12:13 AM
Can't figure out what I have wrong. It's working with FF but not with IE. Here's the page where I have the script posted:

http://www.recruitingware.com/index.htm

Thanks for any help you can offer.

ddadmin
01-18-2006, 12:59 AM
., in this case, http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

Ok, I see two problems. Firstly, for the Ajax link "Online Application", the reason it doesn't work in IE isn't because of the Ajax script, but rather, just IE being picky about the HTML of the external page. For application.htm, remove the table tags and use DIVs instead for formatting. It seems IE doesn't like table tags being inserted into a DIV tag, in this case, <DIV id="content">

Another problem exists in your second link, "Candidate Tracking". "You've specified "rightcolumn" as the DIV to insert the contents into, but this DIV doesn't exist on your page.

albatroz
01-18-2006, 07:21 AM
I am also having problems with this Dynamic AJAX content script
http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm
I canīt have it running fine in http://www.virtualorbis.com/web/tabs2.htm


However the other AJAX scipt
http://www.dynamicdrive.com/dynamicindex17/ajaxincludes.htm
works fine here http://www.virtualorbis.com/web/tabs.htm

ddadmin
01-18-2006, 09:44 AM
The problem is due to the source of the embedded pages, for example: http://www.virtualorbis.com/web/comodo2.htm It contains a JavaScript. You can't use Ajax to load pages with external JavaScript in it, at least not in IE. You'll need to remove that JS from the page, and load it via the loadobj() routine included with the Ajax script.

clandestino_bgd
01-18-2006, 12:17 PM
Hi all,
I am trying to load page containing photoalbum script:
http://www.dynamicdrive.com/dynamicindex4/photoalbum.htm
through ajax script
http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

That page has embedded style definitions (copy-pasted) but it cannot be loaded (I get empty page).

However if I invoke page with photoalbum directly via a href, it works.

Can you tell me, what can be the problem?

Kind regards
Milan

ddadmin
01-18-2006, 09:25 PM
If your photoalbum page has directly embedded CSS on it, unfortunately Ajax won't be able to properly load it, not in IE6 at least. If you can completely separate the CSS and scripts from the photoalbum page by putting them in external files, then you can try loading them dynamically via loadobj().

Twey
01-19-2006, 09:53 AM
Yes, because <style> tags need to go in the head, while the script puts the code in a <div>. I should hope the script parses out <html>, <head> and <body> tags from the code it reads in; if not, you shouldn't have those in the page you want to read in, only the contents of the <body>.

clandestino_bgd
01-19-2006, 11:37 AM
Thank you for response!
However, the problem continues.
I have isolated embedded style from photoalbum page (test.html) and put it to css/gallery.css.
Then I defined a href on index.html as:
href="javascript:ajaxpage('test.html', 'Content');javascript:loadobjs('css/gallery.css')"

I have:
1. <div id="Content"> on index.html
2. test.html in the same level as index.html
3. gallery.css in css folder

I debugged ajax.js with alerts and everything seems to be ok:
1. gallery.css is loaded (it exists in loadedobjects string)
2. ajaxpage detects browser correctly and invokes method loadpage

Also, I expereminted with the following on test.html (photoalbum page which should be invoked by ajax):
1. remove css declaration from head
2. declare css with LINK
3. declare css with import
4. remove tags except body content

But I get no response in each situation.

I would really appreciate any further hint.

Thank you.
Kind regards
Milan

Twey
01-19-2006, 04:02 PM
Are you sure there isn't something that stops the CSS being applied? Something like:
body > .text { 1:2;3:4; }obviously won't work, as the page isn't being loaded into a <body>.

clandestino_bgd
01-19-2006, 06:25 PM
Hi,
you can see the problem live at http://www.fss.org.yu/agaton

Thanx for the response in advance
Kind regards
Milan

Twey
01-19-2006, 08:04 PM
Ah... the problem is a simple one.
<a href="javascript:ajaxpage('test.html', 'Content');javascript:loadobjs('css/gallery.css')" title="gallery">Gallery AJAX</a>You need no javascript: on the second statement. Also, you shouldn't really use javascript: without providing an alternative, if one is available.
<a href="gallery.html" onclick="ajaxpage('test.html', 'Content');loadobjs('css/gallery.css');return false;" title="gallery">Gallery AJAX</a>

clandestino_bgd
01-19-2006, 08:53 PM
Please see:
http://www.fss.org.yu/agaton/

I have added link as you proposed: Gallery AJAX ONCLCK

Other links:
Gallery HREF - simple href call in order to see source of photoalbum page (it works)

Gallery AJAX MANUAL - a href call of ajax like described in manual: http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

Ajax JS - ajax JS
Photoalbum CSS - phortoalbum styles collected in CSS file

Thank you
Kind regards
Milan

Twey
01-19-2006, 09:06 PM
It does seem to be a purely CSS problem - the stylesheet is now loaded fine, the target div exists, the original content of the div is erased, the content is loaded into it. The only other thing I can point out is that you have both a <link> and a <meta> tag in the loaded page, none of which have any business appearing in a div.

clandestino_bgd
01-19-2006, 09:55 PM
I tried to remove:
1. only meta tag
2. LINK to css
3. both
4. whole head

no change.

Any other hint?

Thanx
Milan

Twey
01-20-2006, 05:13 PM
As much as I hate to admit it, I'm afraid I'm stumped :-\ No doubt John or Mike will come along in a moment and point out something really obvious I've missed :)

clandestino_bgd
01-23-2006, 11:24 AM
Thank you Twey.
I am really stucked and cannot solve that.
Hope, somebody will help.

KInd regards
Milan

ddadmin
01-24-2006, 02:35 PM
Firstly, please note that your page is in violation of our usage terms, as the credit notice is removed from the page's source. Please be sure to reinstate it should you use any script on DD.

Regarding your problem, it's actually due to the Photo Album script using document.write() to dynamically output its contents. Since document.write() must be called inline (as the page is loading) in order to work, using Ajax to dynamically request this content isn't possible, unfortunately.

clandestino_bgd
01-24-2006, 03:16 PM
Thank you for the clarifications and warning.
I will put that when I make my site available.
The page you saw is for demonstration purpose.

Kind regards
Milan

Twey
01-24-2006, 06:45 PM
No doubt John or Mike will come along in a moment and point out something really obvious I've missedWell, half right :p