I am trying to get the price of Item after selecting the item in a dropdown. I have used ajax calls but my code is not going inside $.ajax({...
. What is wrong with my code?
I have used alert in the php file but nothing displays, which means my code is not calling php file.
<script type='text/javascript'>
$("#puja_name2").on('change',function()
{
var id=$(this).val();
var data = 'id='+ id;
$.ajax({
type: "POST",
url: "../ajax_price.php",
data: data,
cache: false,
success: function(html)
{
$("#puja_price2").html(data);
}
});
});
</script>
<div class="form-group">
<label>
Puja Name<span class="font-red">* </span>:
</label>
<select class="form-control" name="puja_name2" id="puja_name2" data-validetta="required">
<option value="">Select Puja Name</option>
<?php
$SQL_STATEMENT_puja = $DatabaseCo->dbLink->query("SELECT * FROM puja_type ");
while($DatabaseCo->dbRow = mysqli_fetch_object($SQL_STATEMENT_puja)){
?>
<option value="<?php echo $DatabaseCo->dbRow->puja_id; ?>" ><?php echo $DatabaseCo->dbRow->puja_name; ?></option>
<?php
}
?>
</select>
</div>
<div class="form-group">
<label> Price <span class="font-red">* </span>:</label>
<select id="puja_price2" >
</select>
</div>
</div>