var id = 45;
$.ajax({
url :'url', // This URL response some HTML content
type: 'POST',
dataType: 'json',
data :{ID:id},
success:function(data)
{
console.log(data); // No Response here
},
error : function (error){
console.log(error); // error.responseText contain html content
}
});
I render HTML content by JQuery AJAX. The HTML response comes from error function instead of success function. is any mistake from my side?
Use html instead of json for datatype
The datatype property specifies the type of data that you're expecting back from the server
$.ajax({
url :'url', // This URL response some HTML content
type: 'POST',
dataType: 'html',
data :{ID:id},
success:function(data)
{
console.log(data); // No Response here
},
error : function (error){
console.log(error); // error.responseText contain html content
}
});
See the Jquery Api for more details
Hope this helps.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments