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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.