My callback function returns data as text, but my callback function is not recognizing it and executes always the else condition.
Here are my ‘calling’ parameters
$.post('ajaxupdate.php', data, handleAjaxResponse, 'text');
and my callback function is:
function handleAjaxResponse(response) {
if (response == 'worked') {
alert("hi");
}else{
console.log(response);
};
} // End of handleAjaxResponse() function.
and my php echoes the string code on jQuery success.
If you are echoing text/string, you can simply ignore the
textoption in ajax call, try this: