Via AJAX i am requesting certain informaiton. The script either returns the content as html or in case of an error returns JSON (error number and description).
How can i fix the success message to cater for both?
$.ajax({
cache: false,
type: "POST", //POST
url: processPageURL,
data: dataValues, //form seralize
dataType: "html",
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.responseText);
},
success: function (data) {
alert(data);
}
});
Thanks