glennn.php Posted August 11, 2011 Share Posted August 11, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/244545-newbie-need-onchange-to-update-a-php-var-and-refresh-a-div/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.