PHP Jquery onchange event -


i have selectbox filter featured in form, how use jquery replace onchange event avoid whole page refresh? want div block able reload callback data when option selected.

<form name="form_filter" action="<?php echo $_server['php_self'].'?'.$_server['query_string'].'#network-programs' ?>" method="post" enctype="multipart/form-data"> genre: <select name="filtergenre" id="filtergenre" onchange="this.form.submit()"  > <option value="all" selected="selected">all</option> <?php $query1 = "select * video vcat_id in(select category_id categories video_id in(select vid `video` vuser_id='8') , main_cat=1)"; $result = mysql_query($query1);  while($row = mysql_fetch_assoc($result)) {     $vcat_id = stripslashes($row['vcat_id']);     $vcat_name = stripslashes($row['vcat_name']);      echo "<option value='".$vcat_id."'";      if($vcat_id == $_post['filtergenre']){echo ' selected ';}     echo ">".$vcat_name."</option>"; } ?> </select>  </form> 

please advise, thanks.

$(document).ready(function(){  $('#filtergenre').change(function(){  $.ajax({       url   : form action,       data  : $('#your form id').serialize(),       type : 'post',       success : function(data){                       $('#yourdiv').html(data);                   }    })  })  }) 

remove onchange select


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -