Simple JavaScript not working, no errors...

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Simple JavaScript not working, no errors...

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

What's the purpose behind myvar being an array?

Have you had ajaxpage alert what it's receiving?
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Post 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)
Post Reply