And just to be clearer when I said: " Ultimately, my confusion lies in the fact that the javascript executes perfectly and the gallery works if all the html is on one page but if a part of the html is retrieved by ajax (and it is the exact same javascript code on the retrieved html page), it refuses to work with evalScripts set to true. I cannot understand why. "
I'm aware that the only difference between the two situations is that mootools request is being used in the second scenario to fetch the code, so the problem must be with that. However, mootools request is intended to fetch html and execute javascript, including inline javascript contained in html. Therefore I don't understand the errors that occur, which seem to boil down to a conflict between mootools request and the jdgallery.js code. On Apr 8, 8:51 pm, Manohman <[email protected]> wrote: > I think we are misunderstanding eachother. Apologies as I don't mean > to test your patience, you've been very helpful. > > To confirm what I understand: > > - I am aware of mootools trying to execute any javascript in <script> > tags on the retrieved content when evalScripts is true. I set > evalScripts to true deliberately to make this happen as the gallery > recommends an inline javascript just before where a jdgallery is > placed. > - I am aware - due to there being no problems when I remove the > javascript from the retrieved content html - that it is the executed > javascript in the retrieved html that is causing the errors. > Unfortunately the gallery needs the javascript there. > > - I still do not understand your use of the word 'should'. To me this > suggests that something is not in place and should be in place. As far > as I aware, the code that you said I should use ('I think your code > should be...') is what I already have. Or else you're confirming that > that piece of the code looks accurate and should remain? > > - I also do not understand why you now say I have no reason to eval > the response when an earlier piece of code you suggested I try had eval > (response)? > > Ultimately, my confusion lies in the fact that the javascript executes > perfectly and the gallery works if all the html is on one page but if > a part of the html is retrieved by ajax (and it is the exact same > javascript code on the retrieved html page), it refuses to work with > evalScripts set to true. I cannot understand why. > > Thanks > > On Apr 8, 7:42 pm, Thierry bela nanga <[email protected]> wrote: > > > what i said is, > > you have no reason to eval the response since it is not javascript. the eval > > in onComplete is not necessary. > > > but since you set evalScripts to true, mootools will try to execute scripts > > in the response (I mean the content on any <script> tag). > > > this should be the reason why you have errors. > > > On Wed, Apr 8, 2009 at 7:30 PM, Manohman <[email protected]> wrote: > > > > Apologies, I thought I'd listed every angle I've tested but I forgot > > > to mention one. I ran the page and requested the content successfully > > > when the javascript on the content page was removed. I had already > > > narrowed it down to that but didn't word that correctly. > > > > I also noticed that > > > > - the javascript runs perfectly if it's on the parent page and not > > > requested as content. > > > - some other javascripts run fine on the requested content when > > > testing, meaning the evalscripts is doing its job > > > - the mootools request and jdgallery both run from mootools so I > > > thought I'd be easing conflicts by using this combination. > > > > 'I think your code should be > > > onComplete: function(response) { $('page7content').set('html', > > > response); } > > > since reponse should be in html, ' > > > > If I'm not misinterpreting what you mean, I believe that's the way the > > > code is already and I can't see a change? > > > > Thanks. > > > > On Apr 8, 5:21 pm, Thierry bela nanga <[email protected]> wrote: > > > > I see, > > > > > I think your code should be > > > > > onComplete: function(response) { $('page7content').set('html', > > > > response); > > > } > > > > > since reponse should be in html, > > > > > you have set > > > > > evalScripts to true, this means mootools will run any javascript in the > > > > response, and what I say is that the error message you have come from > > > > the > > > js > > > > in the response. > > > > > On Wed, Apr 8, 2009 at 4:48 PM, Manohman <[email protected]> wrote: > > > > > > Sure you can, is there something I have to paste? I'm unsure because I > > > > > couldn't catch it with your code. > > > > > > On Apr 8, 4:41 pm, Thierry bela nanga <[email protected]> wrote: > > > > > > Ooops, sorry > > > > > > > can I take a look at the response ? > > > > > > > On Wed, Apr 8, 2009 at 4:28 PM, Manohman <[email protected]> > > > wrote: > > > > > > > > Thanks again Thierry, I appreciate the help. I'm not the best at > > > this > > > > > > > (hence why I'm probably stuck in the first place) but it's > > > returning a > > > > > > > 'response not defined' when I insert the code. I imagine I might > > > have > > > > > > > put it in the wrong place but I tried to put it where I thought it > > > > > > > might catch the response. > > > > > > > >http://www.copypastecode.com/codes/view/4623 > > > > > > > > On Apr 8, 4:01 pm, Thierry bela nanga <[email protected]> wrote: > > > > > > > > the problem probably come from the eval, > > > > > > > > you can test with a try/catch to see where is the problem > > > > > > > > > try { > > > > > > > > > eval(reponse); > > > > > > > > > } > > > > > > > > > catch(e) { > > > > > > > > > alert([e.message, e.fileName, e.lineNumber].join('\n')); > > > > > > > > > } > > > > > > > > On Wed, Apr 8, 2009 at 3:49 PM, Manohman <[email protected]> > > > > > wrote: > > > > > > > > > > Thanks Thierry. I can't see a problem with it so far. > > > > > > > > > jdGallery > > > is > > > > > > > > > already running on the parent page and has a seperate gallery > > > > > running > > > > > > > > > successfully. It's also been set up correctly to allow 2 > > > distinct > > > > > > > > > jdgallerys to run on the same page. Even though jd.gallery.js > > > is > > > > > > > > > already running on the parent page, I tried pasting in the > > > > > > > > > code > > > > > into > > > > > > > > > script tags on the requested content page to allow evalscript > > > to > > > > > run > > > > > > > > > through it aswell, which made no difference. I didn't think it > > > > > would > > > > > > > > > if it's already running before the content's requested. > > > > > > > > > > Here is the content that's being requested: > > > > > > > > > >http://www.copypastecode.com/codes/view/4621 > > > > > > > > > > On Apr 8, 3:23 pm, Thierry bela nanga <[email protected]> > > > wrote: > > > > > > > > > > you should check the content you requested instead, > > > > > > > > > > > On Wed, Apr 8, 2009 at 3:15 PM, Manohman < > > > [email protected]> > > > > > > > wrote: > > > > > > > > > > > > Hi, > > > > > > > > > > > > I'm getting this error from firebug while trying to load a > > > html > > > > > > > page > > > > > > > > > > > containing jondesigns smoothgallery into a div using > > > mootools > > > > > > > request: > > > > > > > > > > > > ob.toString is not a function > > > > > > > > > > > imgPreloader.src = this.galleryData[0].image; > > > > jd.gallery.js > > > > > > > > > > > > The smoothgallery/jdgallery code is the unchanged standard > > > code > > > > > > > given > > > > > > > > > > > with the demos. It works fine if it's not dynamically > > > loaded > > > > > into a > > > > > > > > > > > div with ajax so I don't believe it's the html or css (and > > > > > haven > > > > > > > > > > > included them here). > > > > > > > > > > > > I have evalScripts to true and it's definitely trying to > > > > > process > > > > > > > them. > > > > > > > > > > > > My ajax script is here: > > > > > > > > > > > >http://www.copypastecode.com/codes/view/4620 > > > > > > > > > > > > I think there's a conflict between mootools request and > > > > > > > > > > > the > > > > > > > > > > > smoothgallery. > > > > > > > > > > > > Any ideas? Thanks > > > > > > > > > > > -- > > > > > > > > > > fax : (+33) 08 26 51 94 51 > > > > > > > > > -- > > > > > > > > fax : (+33) 08 26 51 94 51 > > > > > > > -- > > > > > > fax : (+33) 08 26 51 94 51 > > > > > -- > > > > fax : (+33) 08 26 51 94 51 > > > -- > > fax : (+33) 08 26 51 94 51
