I needed to write a function with ajax for rd-mailform, but the string is not parsed. Does anyone know what the problem is?
"@EmailAuth": {
rule: function(e) {
email = e.val();
$.ajax({
type: "POST",
url: "auth.php", // php return {"login":1,"status_":0,"user":null}
async: false,
cache: false,
timeout: 30000,
data: {
"login": email
},
success: function(response) {
--------------
var res = JSON.parse(response);
console.log(response.status_); // not work; why script stop?;
--------------
--------------
var res = JSON.parse('{"login":1,"status_":0,"user":null}');
console.log(response.status_); // work; script running continue;
--------------
}
});
return Boolean(status)
},
message: "E-mail not found"
},