Jump to content

*newbie* need onchange to update a php var AND refresh a div


glennn.php

Recommended Posts

i'm a jquery/ajax newbie, folks, sorry...

 

i'm a php guy, tho, and i need a select formfield to update a variable for me (for a mysql query) and then call a js function using onChange:

 

 

<div id="loaded-sidebar">

<script>
// Loads left side content from a url
function sidebarLoad(url) {
var ajax_content_h = $('#ajax').height();
$('#ajax').css({'overflow':'hidden','height':ajax_content_h});
$('#ajax #loaded-sidebar').fadeOut(200,function(){
	$('#ajax .overlay-icon').show();
});
$.ajax({
	url: url,
	success: function(html){
		preload_images(jQuery('img',jQuery(html)),function(){
			$('#ajax').append('<div id="new-sidebar" style="width: 100%; visibility:hidden; overflow: hidden;">'+html+'</div>');
			var new_h = $('#ajax #new-sidebar').height();
			$('#ajax #new-sidebar').remove();
			$('#ajax').animate({
				height: new_h
			}, 1000, function() {
				$('#ajax').html('<div class="overlay-icon"> </div>'+'<div id="loaded-sidebar" style="display: none;">'+html+'</div>');
				$('#ajax .overlay-icon').hide();
				$('#loaded-sidebar').fadeIn(1000);
				$('#ajax').css({'overflow':'','height':'auto'});
				cufon_replace();
				init_popup();
				init_dragable();
			});
		});
	}
});
}
</script>



<form action="#">
<select id="cat" onChange="">
<option value="Media">Media</option>
<option value="Social Life">Social Life</option>
</select>
</form>


<?php
$cat = "form.cat value goes here";

$result = mysql_query("SELECT * FROM articles WHERE user_id = '$usr' AND article_description = '$cat' ORDER BY id DESC"); 

while(...);
?>

     
</div>

 

i'd be very much obliged if someone could help me out...?

 

i do see that all that is within the very div that is being refreshed, and i'm not sure if that's a problem or not

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.