I am trying to perform the following fadeIn/fadeOut action within the jQuery $.post function.
$.post('Scenario/SaveScenario', function (data) {
$('<div class="save-alert">The current scenario has been saved.</div>')
.insertAfter($('.buttons'))
.fadeIn('slow')
.animate({ opacity: 1.0 }, 2000)
.fadeOut('slow', function () {
$(this).remove();
});
});
However, this does not work and (apparently) nothing happens. (I put a breakpoint inside the function within Firebug and it is never reached.) The post is happening successfully as the scenario is being put into my database. I don't believe that is the problem.
I tested it out by just adding it as a click event on the submit button and that did work.
$(function () {
$('#SaveScenario').click(function () {
$('<div class="save-alert">The current scenario has been saved.</div>')
.insertAfter($('.buttons'))
.fadeIn('slow')
.animate({ opacity: 1.0 }, 2000)
.fadeOut('slow', function () {
$(this).remove();
});
});
});
Any theories about what I am doing wrong?