A Javascript Boggle

Miscellaneous Forums/General Discussion/A Javascript Boggle

Ok, second question (and hopefully last) of the day. Ive hit another snag with this rather complex page im trying to put together. Im not a PHP or JavaScript developer, but i am stuck with trying to resolve the issue. So its taken a few hours having never used it before but I think i get the principal of Ajax and there is some code already built into this site (in the form of libraries) called PROTORYPE and JQUERY so i have those libraries available to me.

So what I want to do is 2 things.

Currently, there is a list of people and when you click on one, an area expands with some information. At this point i would like to call a javascript to load their related images into an ajax area.

Calling the code is not a problem when they click someone, what is a problem is loading the images from the php file that returns them into an existing DIV or SPAN area.

Now, i had functions on another page (by the other developer who has done a bunk) which looked like this:-

function loadNews(id) 
{
   $("#drop"+id).load("/getcontent.php?o="+id+"&type=news");
}


now there was a DIV on the calling page that would have been named "drop1" and when clicking on the load news link (which calls the above method), the text changes to the news. Hurrah.

However, on MY page when I am calling (and the correct params are getting thru as an alert in the function tells me so)

On the page i have (for now) a hardcoded link.

<a href="javascript:loadGalleries('#pic1',1);">LoadGals</a>


Elsewhere on that page I have (again temporarily hard coded)..

<div id="pic1" class="col_x_5">	
gallery goes here.
</div>

(ive tried a span as well)

and in the JS (which is firing correctly) I have:-

function loadGalleries(_target, _artistId)
{
	$("pic1").load("/getgals_ajax.php?o="+id);
}



Ive tested the response from getgals_ajax.php and it returns the images as it should.

So what i want to do is return those images and put the code within a DIV/SPAN on an existing page.

Basically this part of the site is an image thumbnail viewer.

Any ideas?

A

Whats is the # (hash) there for? Is that a jQuery shortcut for class rather than id?

Ok, i think ive cracked it. I forgot to put a + to concat the ID of the element. See this is why you shouldnt code for 12 hrs without going outside!

JQuery is installed there, but to be honest i dont know what the # is there for. That part of the string refers to a DIV/SPAN WITH an ID assigned and the others work with a # there so i copied the syntax.

As I said, im fumbling my way through this (not by choice). Thanks for your assistance today Indi.

A

See this is why you shouldnt code for 12 hrs without going outside!
Funny you should mention that, I usually post my problems (general coding) and leave the desk for awhile; most of the time I find the answer :P