I've got this snippet of javascript that sends data to my database and then shows a success message.
Currently, when the operation is successful, the button fades out and hides correctly. However, the success message doesn't appear.
$(document).ready(function () {
$('form.user_status').submit(function () {
var userna = $(this).find("[name='userna']").val();
var joborder_id = $(this).find("[name='joborder_id']").val();
var user_email = $(this).find("[name='user_email']").val();
var app_status = $(this).find("[name='app_status']").val();
// ...
$.ajax({
type: "POST",
url: "user_status.php",
data: {
userna: userna,
joborder_id: joborder_id,
user_email: user_email,
app_status: app_status
},
success: function () {
$('form.user_status').hide(function () {
$('div.success').fadeOut();
});
success = 'Status changed';
}
});
return false;
});
});
This is the HTML where the success message should be displayed:
<div class="success" style="display: none;"></div>