Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-21-2009, 06:41 PM   PM User | #1
hookedupphat
New to the CF scene

 
Join Date: Nov 2009
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
hookedupphat is an unknown quantity at this point
jQuery and ajax load works once, stop working

I posted this in the ajax forum, I think it belongs here...sorry

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.

Code:
<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";
	$("#load").click(function(){
		$("#cal_content").html(ajax_load).load(loadUrl, { 'option': ["tom"] } );

	});

});
</script>

<div id="cal_content">

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

</div>

// includes/cal.php

<div id="cal_content">

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

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

</div>

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?
hookedupphat is offline   Reply With Quote
Old 11-21-2009, 07:58 PM   PM User | #2
tomws
Senior Coder

 
tomws's Avatar
 
Join Date: Nov 2007
Location: Arkansas
Posts: 2,644
Thanks: 29
Thanked 330 Times in 326 Posts
tomws will become famous soon enoughtomws will become famous soon enough
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.
__________________
Are you a Help Vampire?
tomws is offline   Reply With Quote
Old 11-21-2009, 08:08 PM   PM User | #3
hookedupphat
New to the CF scene

 
Join Date: Nov 2009
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
hookedupphat is an unknown quantity at this point
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!
hookedupphat is offline   Reply With Quote
Old 11-21-2009, 10:02 PM   PM User | #4
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
The cause of your problem is the same culprit as I explain in this thread:

http://www.codingforums.com/showthread.php?t=180709

If you use the .live(click) function rather than the .click() function you should on your way.
__________________
Fumigator is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:02 PM.


Advertisement
Log in to turn off these ads.