View Full Version : jQuery and ajax load works once, stop working

11-21-2009, 06:41 PM
I posted this in the ajax forum, I think it belongs here...sorry :o

I could really use some help, I'm new to jQuery

Basically I have a calendar with a link to go to the next or previous day. What i have below works once, but once the ajax page loads it stops working.

<script language="javascript">
$(document).ready(function() {
$.ajaxSetup ({
cache: false
var ajax_load = "<img src='images/ajax.gif' alt='loading...' />";

// load() functions
var loadUrl = "includes/cal.php";
$("#cal_content").html(ajax_load).load(loadUrl, { 'option': ["tom"] } );



<div id="cal_content">

<a href="#" id="load">Next</a>


// includes/cal.php

<div id="cal_content">

<? if($_POST['option']...blah blah blah ?>

<a href="#" id="load">Next</a>


Obviously there's a lot more code in these files I did not include, but that's what you need to know. It is loading cal.php into the dom just fine, but once it's in there, it doesn't work. I've tried using class instead of id values, but it does the same thing.

Can anyone help me please?

11-21-2009, 07:58 PM
Double-posting is frowned upon. If you can't delete this thread, you might want to PM a mod and ask for a removal. I've posted a response over in the AJAX subforum.

11-21-2009, 08:08 PM
yea, as i said in the beginning of this post, i'm sorry for the double post, i did not see a frameworks forum. This can be deleted, thanks for your help in the other thread tomws!

11-21-2009, 10:02 PM
The cause of your problem is the same culprit as I explain in this thread:


If you use the .live(click) function rather than the .click() function you should on your way.