Return to Snippet

Revision: 46057
at May 19, 2011 00:47 by flexyournoggin


Updated Code
<!-- here is the updated code to include the Forming sub-cats -->
<script>
$(document).ready(function() {
	var val = $('#blogcategory').attr('value');
	$("#vanpoolResults").empty("");
	$("#vanpoolResults").fadeOut("fast");
	
		$('#blogcategory').change( function() {

				 var chosenoption=this.options[this.selectedIndex] //this refers to "selectmenu"
						$("#destination_point").fadeOut("slow");
						$("#departure_point").fadeOut("fast").empty("");
						$("#vanpoolResults").fadeOut("fast").empty("");
				
			if ( (chosenoption.value == '142' || chosenoption.value == '159') )  {

				  $("#vanpoolResults").empty("");
					var val = $('#blogcategory').attr('value');
					
					$.getJSON('./js/comboboxes.php?q=' + val, function(json){

						$("#destination_point").html("<option value='' selected='selected'>&rarr; Choose your Origin &larr;</option>");
						$("#departure_point").fadeOut("fast");	$("#vanpoolResults").fadeOut("fast"); 
					
					for(var i=0; i < json.length; i++){
						$("#destination_point").append("<option value='" + json[i].cat_id + "'>" + json[i].cat_name + "</option>"); }
						
						$("#destination_point").fadeIn("slow");
						
						});// end for loop
					
					$('#destination_point').change( function() {
						$("#vanpoolResults").fadeOut("fast").empty("");
					
					var val2 = $('#destination_point').attr('value');
					$.getJSON('./js/new_boxes.php?q=' + val2, function(json2){
					
					 for(var i=0; i < 1; i++){ // This for loop is executing multiple times depending on the number of times you have chosen an option that has a secondary menu. Second time you've chosen one - it executes this twice. Third time - executes 3 times. etc. on and on. WHYYYYY???
					 	$("#vanpoolResults").empty("");
						$("#vanpoolResults").append(json2[i].field_id_5).fadeIn("fast"); }
					
						}); }); } // end of if 
				
				// This is the default for all single-destination selection vanpools
				else {  $.getJSON('./js/new_boxes.php?q=' + chosenoption.value, function(json){
						$("#filtersidebar").html("<option>&rarr; Your Available Pools &larr;</option>");
						for(var i=0; i < json.length; i++){	$("#vanpoolResults").append(json[i].field_id_5); } $("#vanpoolResults").fadeIn("fast");	});	$("#vanpoolResults").fadeIn("fast"); 
						} 	}); 
				}); // end something or other, do backflips if this is working and praise Odin


</script>

Revision: 46056
at May 13, 2011 00:31 by flexyournoggin


Updated Code
<!-- here is the updated code to include the Forming sub-cats -->
<script>
$(document).ready(function() {
	var val = $('#blogcategory').attr('value');
	$("#vanpoolResults").empty("");
	$("#vanpoolResults").fadeOut("fast");
	
		$('#blogcategory').change( function() {
					
				 var chosenoption=this.options[this.selectedIndex] //this refers to "selectmenu"
						$("#destination_point").fadeOut("slow");
						$("#departure_point").fadeOut("fast").empty("");
						$("#vanpoolResults").fadeOut("fast").empty("");
				
			if ( (chosenoption.value == '142' || chosenoption.value == '159') )  {
				  $("#vanpoolResults").empty("");
					var val = $('#blogcategory').attr('value');
					
					$.getJSON('./js/comboboxes.php?q=' + val, function(json){
						$("#destination_point").html("<option value='' selected='selected'>&rarr; Choose your Origin &larr;</option>");
						$("#departure_point").fadeOut("fast");	$("#vanpoolResults").fadeOut("fast"); 
					
					for(var i=0; i < json.length; i++){
						$("#destination_point").append("<option value='" + json[i].cat_id + "'>" + json[i].cat_name + "</option>"); }
						
						$("#destination_point").fadeIn("slow");
						
						});// end for loop
					
					$('#destination_point').change( function() {
						$("#vanpoolResults").fadeOut("fast").empty("");
					
					var val2 = $('#destination_point').attr('value');
					$.getJSON('./js/new_boxes.php?q=' + val2, function(json2){
					
					for(var i=0; i < json2.length; i++){
						$("#vanpoolResults").append(json2[i].field_id_5).fadeIn("fast"); }
						
						}); }); } // end of if 
				
			// This is the default for all single-destination selection vanpools
			else {  $.getJSON('./js/new_boxes.php?q=' + chosenoption.value, function(json){
						$("#filtersidebar").html("<option>&rarr; Your Available Pools &larr;</option>");
						for(var i=0; i < json.length; i++){	$("#vanpoolResults").append(json[i].field_id_5); } $("#vanpoolResults").fadeIn("fast");	});	$("#vanpoolResults").fadeIn("fast"); 
						} 	}); 
				
				}); // end something or other, do backflips if this is working and praise Odin


</script>

Revision: 46055
at May 13, 2011 00:09 by flexyournoggin


Updated Code
<!-- here is the updated code to include the Forming sub-cats -->
<script>
$(document).ready(function() {
	var val = $('#blogcategory').attr('value');
	$("#vanpoolResults").empty("");
	$("#vanpoolResults").fadeOut("fast");
	
		$('#blogcategory').change( function() {
					
				 var chosenoption=this.options[this.selectedIndex] //this refers to "selectmenu"
						$("#destination_point").fadeOut("slow");
						$("#departure_point").fadeOut("fast").empty("");
						$("#vanpoolResults").fadeOut("fast").empty("");
				
			if ( (chosenoption.value == '142' || chosenoption.value == '159') )  {
				  $("#vanpoolResults").empty("");
					var val = $('#blogcategory').attr('value');
					
					$.getJSON('./js/comboboxes.php?q=' + val, function(json){
						$("#destination_point").html("<option value='' selected='selected'>&rarr; Choose your Origin &larr;</option>");
						$("#departure_point").fadeOut("fast");	$("#vanpoolResults").fadeOut("fast"); 
					
					for(var i=0; i < json.length; i++){
						$("#destination_point").append("<option value='" + json[i].cat_id + "'>" + json[i].cat_name + "</option>"); }
						
						$("#destination_point").fadeIn("slow");
						
						});// end for loop
					
					$('#destination_point').change( function() {
						$("#vanpoolResults").fadeOut("fast").empty("");
					
					var val2 = $('#destination_point').attr('value');
					$.getJSON('./js/new_boxes.php?q=' + val2, function(json2){
					
					for(var i=0; i < json2.length; i++){
						$("#vanpoolResults").append(json2[i].field_id_5).fadeIn("fast"); }
						
						}); }); } // end of if 
				
				// This is the default for all single-destination selection vanpools
				else {  $.getJSON('./js/new_boxes.php?q=' + chosenoption.value, function(json){
						$("#filtersidebar").html("<option>&rarr; Your Available Pools &larr;</option>");
						for(var i=0; i < json.length; i++){	$("#vanpoolResults").append(json[i].field_id_5); } $("#vanpoolResults").fadeIn("fast");	});	$("#vanpoolResults").fadeIn("fast"); 
						} 	}); 
				
				}); // end something or other, do backflips if this is working and praise Odin


</script>

Revision: 46054
at May 12, 2011 06:06 by flexyournoggin


Initial Code
<!-- here is the updated code to include the Forming sub-cats -->
<script>
$j(document).ready(function() {
	var val = $('#blogcategory').attr('value');
			$("#vanpoolResults").empty("");
				$("#vanpoolResults").fadeOut("fast");
		$('#blogcategory').change( function() {
		 var chosenoption=this.options[this.selectedIndex] //this refers to "selectmenu"
				$("#destination_point").fadeOut("slow"); $("#departure_point").fadeOut("fast").empty("");	$("#vanpoolResults").empty("");	$("#vanpoolResults").fadeOut("fast");
		
		if ( chosenoption.value == '142') {
			var val = $('#blogcategory').attr('value');
			$.getJSON('http://staging.tickettoride.org/js/comboboxes.php?q=' + val, function(json){
				$("#destination_point").html("<option value='' selected='selected'>&rarr; Choose your Origin &larr;</option>");
				$("#departure_point").fadeOut("fast");	$("#vanpoolResults").fadeOut("fast"); 
			
			for(var i=0; i < json.length; i++){
				$("#destination_point").append("<option value='" + json[i].cat_id + "'>" + json[i].cat_name + "</option>"); }
				$("#destination_point").fadeIn("slow");	});
			$('#destination_point').change( function() {
				$("#vanpoolResults").fadeOut("fast"); $("#vanpoolResults").empty();		
			
			var val2 = $('#destination_point').attr('value');
			$.getJSON('http://staging.tickettoride.org/js/new_boxes.php?q=' + val2, function(json){
				for(var i=0; i < json.length; i++){	$("#vanpoolResults").append(json[i].field_id_5); }
				$("#vanpoolResults").fadeIn("fast");
				
				}); }); } // end of if == Downtown Louisville Vanpools
		
		else if (chosenoption.value == '159') {
			var val2 = $('#destination_point')[0];
			$("#vanpoolResults").fadeOut("fast");
			var val = $('#blogcategory').attr('value'); $.getJSON('http://staging.tickettoride.org/js/comboboxes.php?q=' + val, function(json){
				$("#destination_point").html("<option value='' selected='selected'>&rarr; Choose your Origin &larr;</option>");
				$("#vanpoolResults").fadeOut("fast");
			
			for(var i=0; i < json.length; i++){
				$("#destination_point").append("<option value='" + json[i].cat_id + "'>" + json[i].cat_name + "</option>");	}
				$("#destination_point").fadeIn("slow");	});
			$('#destination_point').change( function() {
				$("#vanpoolResults").fadeOut("fast"); $("#vanpoolResults").empty();			
			
			
			var val2 = $('#destination_point').attr('value');
			$.getJSON('http://staging.tickettoride.org/js/new_boxes.php?q=' + val2, function(json){
				
				for(var i=0; i < json.length; i++){	$("#vanpoolResults").append(json[i].field_id_5); }
				$("#vanpoolResults").fadeIn("fast"); }); });}   // end of if == Fort Knox Vanpools
		
		// This is the default for all single-destination selection vanpools
		else {  $.getJSON('http://staging.tickettoride.org/js/new_boxes.php?q=' + chosenoption.value, function(json){
				$("#filtersidebar").html("<option>&rarr; Your Available Pools &larr;</option>");
				for(var i=0; i < json.length; i++){	$("#vanpoolResults").append(json[i].field_id_5); } $("#vanpoolResults").fadeIn("fast");	});	$("#vanpoolResults").fadeIn("fast"); } 	}); }); // end something or other, do backflips if this is working and praise Odin


</script>

Initial URL

                                

Initial Description

                                

Initial Title
New Vanpool Finder for Forming Vanpools

Initial Tags

                                

Initial Language
JavaScript