I trying to get data from data base via ajax code. PHP code works well but ajax reponse always is undefined. I tried json bat resuls is same. here are codes:
var email = $('#email').val();
function getAjax(p, m) {
$.ajax({
url: '../lib/checkmail.php',
type: 'post',
data: {val : p, column : m},
success: function (data) {
return data.toString();
}
});
}
if (email.length > 0){
alert(getAjax(email, 'youremail'));
}