Hello. This is my html code
<div class="col-sm-4">
<label for="area_dd" class="sr-only"></label>
<select name="area_dd" id="area_dd" class="form-control">
<option value="">Please choose area</option>
</select>
</div>
<p id="tessst">I am test</p>
and this is my jquery code
$("#tessst").hide();
$("#city_dd").change(function(){
var city_id=$(this).val();
$.ajax({
url:"pages/fetch_areas_dd.php",
method:"POST",
dataType:"json",
data:{city_id:city_id},
success:function(data){
console.log(data);
$("#tessst").show();
$("#area_dd").html(data);
},
error:function(){
alert("error");
}
});
});
The problem is success function is not working properly. Html elements are no more accessed in the success method of ajax. I mean when response is return from server I want to show the returned data in html element and id of that element is “#area_dd”. Console.log(data) is working fine. But $(“#area_dd”).html(data) and $(“#tessst”).show() are not working in the success method.