I have a weird issue.
function sendEmail(settings) {
var success = false;
$.ajax({
type: "POST",
contentType: settings.contentType,
data: settings.data,
url: settings.url,
dataType: "json",
async: false,
beforeSend: function () {
setTimeout(showOrHideLoadingImage("LoadingImage", "show"), 2000);
//$("#LoadingImage").show();
},
success: function (data) {
setTimeout(showOrHideLoadingImage("LoadingImage", "hide"), 500);
//$("#LoadingImage").hide();//Hide loading image
showOrHideLoadingImage function:
function showOrHideLoadingImage(id, action)
{
if (action == "show") {
$("#" + id).show();
} else {
$("#" + id).hide();
}
}
I use this code to send mail, the mail is arriving BUT the ajaxLoading image is not showing
if i put a "debuger" in the "beforeSend" event the image is shown, so I tried to use java script setTimeout function, but with no luck.
*another quetion that I have regarding this, ajaxSuccess and error Global events.
I red that its better to use these events:
if i will use $("#LoadingImage") each time, the mail loading image will shown
but what if I have other id with loading image?