0

This is my code for dropdown

?><select id="land_unit" name="unit_name" ><?php
$result=$wpdb->get_results("select * from unit");
                 foreach($result as $row) {
                  $unit_id=$row->unit_id;
                  $unit_name=$row->unit_name;     
                 ?>
<option value="<?php echo $unit_id; ?>" <?php if($land_unit== $unit_id){ echo 
 'selected="selected"';} ?>><?php echo $unit_name; ?></option>
<?php  } ?></select><?php 

This is my code in js file

$("#land_unit").on('change', function()
{
 var unit_id=$(this).val();
//alert(id);
});

I want to pass var unit_id to my template file in wordpress. So how do I do that?? My url is like this abc.com/abc so in that case how?

Kedar B
  • 774
  • 5
  • 18
  • 47

0 Answers0