I am using jquery with ajax()
. I am adding data to my table
, so data are getting SUCCESSFULLY added but i am unable to get the response from the URL
i have specified . The problem is error:function is always getting called , but i am getting status code = 200 in my browser , and my json
data is also getting added in the database and success:function() <-- is never getting called
$("#add_detail").on('click',function(){
//alert("cd");
$.ajax({
type:'POST',
url:'http://www.------',
dataType: "json",
data:{
gym_name:$gym_name.val(),
plan_type:$plan_type.val(),
duration:$duration.val(),
amount:$amount.val()
},
async:false,
success:function(){
alert("Success");
}
,
error:function(data, msg){
alert(msg);
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<button id="add_detail">Click here</button>