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 12-17-2009, 12:15 AM   PM User | #1
Gremlyn1
New Coder

 
Join Date: Apr 2009
Location: San Diego, CA
Posts: 64
Thanks: 2
Thanked 1 Time in 1 Post
Gremlyn1 is an unknown quantity at this point
Livequery not reattaching handlers

So using this function:
Code:
$j(".versions").livequery('change', function() {
	var verid = $j(".versions option:selected");
	var prodid = $j(this).attr('id');
	$j.ajax({
		method: "get",
		url: "../includes/ajax/release.php",
		data: "vid="+verid.val()+"&mdl="+prodid,
		beforeSend: function() 
			{$j('#loading').show('fast');},
		complete:  function() 
			{$j('#loading').hide('fast');},
		success: function(json) {
			$j('.rel_info').show('slow');
			$j('.rel_info').html(json);
		}
	});
});
The script will run, i.e. the data loads via AJAX when I select the items from my drop down, but the event handlers in the subsequently called script don't reattach like they should. Am I missing something in the implementation? FireBug is giving me no errors.

The content I pull in via AJAX gives me a list of categories, titled by links that when clicked use the toggle event to show the data for that category. This is an example of the toggle function:
Code:
		
$j("#guideClick").click(function(){
	$j('#guidenotes').toggle("fast", function() {
		var aliveTime = $j.ajax('includes/alive.php');
	});
	var img_src = $j("#guideImg").attr('src');
	if (img_src == img_expand) {
		var curr_img = img_collapse;
	} else if (img_src == img_collapse) {
		var curr_img = img_expand;
	}
	$j("#guideImg").ImageSwitch({NewImage:curr_img, Speed: 1});
	return false;
});
The toggle works when not being called by AJAX, so I know that piece of code is sound. Thanks in advance!
Gremlyn1 is offline   Reply With Quote
Old 12-17-2009, 05:15 PM   PM User | #2
Gremlyn1
New Coder

 
Join Date: Apr 2009
Location: San Diego, CA
Posts: 64
Thanks: 2
Thanked 1 Time in 1 Post
Gremlyn1 is an unknown quantity at this point
Oh.... don't mind me! I was trying to use the livequery call on the ajax function, where it should have been used on the functions I want rebound.

The second function should be:
Code:
$j("#guideClick").livequery('click', function(){
	$j('#guidenotes').toggle("fast", function() {
		var aliveTime = $j.ajax('includes/alive.php');
	});
	var img_src = $j("#guideImg").attr('src');
	if (img_src == img_expand) {
		var curr_img = img_collapse;
	} else if (img_src == img_collapse) {
		var curr_img = img_expand;
	}
	$j("#guideImg").ImageSwitch({NewImage:curr_img, Speed: 1});
	return false;
});
Gremlyn1 is offline   Reply With Quote
Reply

Bookmarks

Tags
ajax, event handler, jquery, livequery, php

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 02:24 AM.


Advertisement
Log in to turn off these ads.