forget.php
PHP:
if (! (empty($_POST['emailforget'])) ) {
echo "here in the function";
} else {
echo "here";
}
AJAX:
$("#passreset").on('click', function(e) {
var emailforget = $("#tempemail").val();
alert(emailforget);
//ajax call here
$.ajax({
type: "post",
url: 'user/forgetpass.php',
data: {
'emailforget': emailforget
},
cache: false,
contentType: false,
processData: false,
beforeSend: function() {
//alert("here in function beforesent");
},
success: function(html) {
//alert(html);
document.getElementById("error").innerHTML = html;
},
error: function() {
alert("alert error");
}
});
return false;
});
HTML:
<input type="email" id="tempemail" name="tempemail"
placeholder="Enter your email address" value="ab.waseem@yahoo.com" required>
The code was working perfectly but suddenly stopped working.
Checking in Firefox and Chrome console gives no error.
The call is sent perfectly to the respective file.