AJAX Get/Post Functions being weird
I'm trying to build two functions for easily calling AJAX through JQuery. They both currently work, the only problem is that the .post method function will show the 'loading' message, and the .get will not. Any ideas on what I'm doing wrong here?
-
// LOAD CONTENT VIA AJAX GET
#########################################################
function ajaxLoad(url,containerid,loadmsg)
{
$.get(url, function(data)
{
$('#'+containerid).ajaxStart(function()
{
$('#'+containerid).html('<div id=\"loader\">'+loadmsg+'</div>');
});
$('#'+containerid).ajaxStop(function()
{
$('#'+containerid).html(data);
});
});
}
// SEND FORM VIA AJAX POST #########################################################
function ajaxPost(url,formid,containerid,loadmsg)
{
$.post(url, $('#'+formid).serializeArray(), function(data)
{
$('#'+containerid).ajaxStart(function()
{
$('#'+containerid).html('<div id=\"loader\">'+loadmsg+'</div>');
});
$('#'+containerid).ajaxStop(function()
{
$('#'+containerid).html(data);
});
});
}