I'm confused. I thought in your first post you said you didn't want it
to append, and now it seems like you're saying you do?

At any rate, the syntax for get is documented here:
http://docs.jquery.com/Ajax#.24.get.28_url.2C_params.2C_callback_.29

In your case, it would be something like this:
$.get('generate.cfm', function(data) {
 $('#files_list').after(data);
});

But again, I'm not quite sure what you're looking for, and I'm going
to bed now :)

Check out the API for more help. In particular, it seems like the
"Manipulation" section could be useful for you:
http://docs.jquery.com/DOM/Manipulation

Good luck!

--Erik


On 6/4/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

it just returns some html (actually just a random image tag "<img
src="something.jpg">")

What I want to do is take and add whatever image the ajax call returns
and add it to the list... maybe it is better to just return the name
of the image and then use jquery to actually add the <img > tag?

I think I am getting close.


On Jun 4, 1:44 am, "Erik Beeson" <[EMAIL PROTECTED]> wrote:
> Your syntax for $.get is wrong. What exactly does generate.cfm return?
>
> --Erik
>
> On 6/4/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
> > Thanks for the tips!
>
> > Actually I am trying to create a list of pictures, not replace the
> > image.  I am thinking something like this but it is failing:
>
> > $('#files_list').after($.get('generate.cfm'));
>
> > Must be something small...
>
> > On Jun 4, 1:03 am, "Erik Beeson" <[EMAIL PROTECTED]> wrote:
> > > Hard to say for sure without seeing the code. Sounds like you're
> > > appending a new image element? You could instead just update the src
> > > attribute of the image tag in question:
>
> > > <img id="the_image" src="original_image.png"/>
>
> > > var newImageURL = 'new_image.png'; // load new image URL from somewhere
> > > $('#the_image').attr('src', newImageURL);
>
> > > --Erik
>
> > > On 6/3/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > > > I'm pretty sure it can since jquery is so sweet, but here's what I am
> > > > trying to do:
>
> > > > I have a page (call it generator.cfm) that pulls random pictures from
> > > > a database.
>
> > > > I want a button or link I can click on and have it pull from that url,
> > > > and display in the div or whatever.  pretty simple ajax stuff.
>
> > > > But the tricky part is if I continue to click on the button it doesnt
> > > > replace the existing picture, it just appends on the next picture to
> > > > the list each time the button is clicked.
>
> > > > Any of you guru's care to help me figure this out?


Reply via email to