Page 1 of 1

Simple JavaScript not working, no errors...

Posted: Mon Oct 29, 2007 5:35 pm
by JAB Creations
I'm trying to construct a URL to dynamically handle loading AJAX includes for different galleries on my site. The script loads a set of thumbnails (32 thumbnails per set) in to an element with an ID.

The script is triggered via XHTML as so...

Code: Select all

<a href="javascript:thumbs02('cowboybebop/session01');">next thumbnail set</a>
So I'm trying to create a string of...
templates/cowboybebop/session01/thumbs-02.tpl
...for the AJAX script to load.

Here is my general attempt (and I've gone through numerous variations to get this to work correctly)...

Code: Select all

function thumbs02(url) {
myvar = [url];
ajaxpage('templates/' + myvar + 'thumbs-02.tpl', 'galleryajax');
}
Once I get that working I'll attempt to remove the need for multiple functions (01~10 with this once I get it to work). But I just want to get this part to work right now. Thanks!

PS - Is it just me or has the site been a little slow today?

Posted: Mon Oct 29, 2007 5:56 pm
by feyd
What's the purpose behind myvar being an array?

Have you had ajaxpage alert what it's receiving?

Posted: Mon Oct 29, 2007 7:10 pm
by JAB Creations
I'm a bit new to passing stuff through function('this_part_here'); and thankfully this worked!

Code: Select all

function thumbs02(url) {
ajaxpage('gallery/' + (url) + '/ajax_thumbs-02.tpl', 'galleryajax');
}
...and yes I use alert all the time. I also decided to check my error log to see if the request was reaching the server and if so what the path was to adjust what I needed. 8)