PDA

View Full Version : problem using ajax to load multiple galleries



Jega
02-01-2008, 10:22 AM
1) Script Title: Dynamic Ajax Content

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

3) Describe problem: Hi everyone :)

I want to be able to load a gallery from a link using ajax. I have never dealt with ajax before but after messing around with the demo script it seemed simple enough until i tried to load a PVII image gallery...it loads the gallery but the gallery doesn't work :confused:

i've uploaded an example of the basic modded demo script here http://groupserver.co.uk/ajax.htm
as you can see if you click the gallery link it doesn't work correctly. You can see the gallery working correctly if you visit the linked page directly http://groupserver.co.uk/external.htm

any help would be much appreciated :o

Jase

BYK
02-01-2008, 10:54 AM
You should call the "P7_HGSinit(1,1,1,1,1,1,0,0)" function AFTER the gallery is loaded dynamically ;)

Jega
02-01-2008, 11:58 AM
You should call the "P7_HGSinit(1,1,1,1,1,1,0,0)" function AFTER the gallery is loaded dynamically ;)

thanks for the quick response :)

on the external page the function is called from a body.onload
how would i call the function after the gallery has loaded? by a window.onload?

BYK
02-01-2008, 12:18 PM
No, definitely not :)

First of all the external page should NOT contain any html, head or body tags, keep this in mind ;)

You should place this function call at the end of the loadpage function. ;)

Jega
02-01-2008, 01:31 PM
No, definitely not :)

First of all the external page should NOT contain any html, head or body tags, keep this in mind ;)

You should place this function call at the end of the loadpage function. ;)

:confused: ok, i removed the html, head and body tags from the external page but i don't know how to call the fucntion from within the loadpage function of the ajax code? :( my head hurts

BYK
02-01-2008, 01:38 PM
You should just write P7_HGSinit(1,1,1,1,1,1,0,0) before the end "}" of the loadpage function ;)

Nothing that hard :)

By the way make sure you have included the gallery script in the main page(the one which has html, head etc. ;))

Jega
02-01-2008, 02:10 PM
BYK you're a star! :D

it seems to be working fine now apart from a null error in the ajax script being reported by IE??

BYK
02-01-2008, 03:47 PM
Everyone knows that I'm nothing but a simple coder but thank you :)

The P7_HGSinit(1,1,1,1,1,1,0,0) function is called EVERYTIME you load a dynamic content. This might be the reason of the null error. If you have some JS knowledge, you may modify the part I told you to change but my insticnts tell me that you do not know very much JS :)

Jega
02-01-2008, 08:13 PM
i'm not 'too bad' with JS so should be able to sort it out but i certainly wouldn't call myself a JS programmer :o

thanks again for all your help :D

BYK
02-01-2008, 08:24 PM
I was not saying you are too bad, but you first acted like yo do know very little JS :)

Then you are welcome and if you have any problems do not hesitate to ask ;)