I am using windows server 2012 and i built web app it was working fine on my local PC
but when I uploaded the code to sever the JQuery ajax function firing error function?
I did search around to find out what is the problem but no thing help
I added dataType:"text"
and it fire the success function but it does not deal with the returned data as JSON. while when I added dataType:"json"
it kept firing the error function
$.ajax({
url:url,
type:"POST",
data:{collegeID: ID},
success:function(res){
if(res.success == 1){
trigger.append("<OPTION value=''>--Select Teacher--</OPTION>");
$.each(res.data,function(){
trigger.append(
"<OPTION VALUE='"+this.teacher_id+"'>"+this.teacher_name_e+" | "+this.teacher_name_a+"</OPTION>"
);
});
}else{
trigger.append("<OPTION></OPTION>");
}
console.log(res);
},
error:function(e){
trigger.append("<OPTION></OPTION>");
console.log(e);
}
});
response without adding dataType or with add dataType:"json"
response when I add dataType:"text"