Reputation: 2926
I have a DIV like this <div id="message"></div>
and trying to add contents to this DIV using Ajax
success.
This is how my ajax code looks like:
var data = $("form#password_forgotten").serialize();
$.ajax({
type: "POST",
url: "./includes/process_password.php",
data: data,
cache: false,
success: function (response) {
console.log(response);
$('#message').html(response);
}
});
But I can not populate #message
div with this ajax response. But this ajax coding is working for me and this is what I can get to console.
<div class='alert alert-danger alert-dismissible' role='alert'>
<strong>Oops!</strong> Email address not recognised. Please try another.
</div>
Can anybody tell me whats the wrong with this?
Thank you.
Upvotes: 3
Views: 1828
Reputation: 15913
As per the conversation in the comments
Now I found my #message DIV populating, but its hiding from my page. Like this - Oops! Email address not recognised. Please try another. ,
Summarizing the answer as
After populating the HTML add $('#message').show()
Upvotes: 1