Subversion Repositories SmartDukaan

Rev

Rev 26063 | Rev 26274 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 26063 Rev 26140
Line 26... Line 26...
26
			+ errorObject.message);
26
			+ errorObject.message);
27
}
27
}
28
 
28
 
29
$(document).ajaxError(function(event, jqxhr, settings, thrownError) {
29
$(document).ajaxError(function(event, jqxhr, settings, thrownError) {
30
	if (typeof loaderDialogObj != "undefined")
30
	if (typeof loaderDialogObj != "undefined")
-
 
31
		{
31
		loaderDialogObj.modal('hide');
32
			loaderDialogObj.modal('hide');
-
 
33
			$('div.modal-backdrop.fade').remove();
-
 
34
		}
32
	if (jqxhr.status == 400) {
35
	if (jqxhr.status == 400) {
33
		// $('#error-prompt-model').modal();
36
		// $('#error-prompt-model').modal();
34
		badRequestAlert(jqxhr);
37
		badRequestAlert(jqxhr);
35
	} else {
38
	} else {
36
		internalServerErrorAlert(jqxhr);
39
		internalServerErrorAlert(jqxhr);
37
	}
40
	}
38
});
41
});
39
 
42
 
40
$(document).ajaxComplete(function() {
43
$(document).ajaxComplete(function() {
41
	if (typeof loaderDialogObj != "undefined")
44
	if (typeof loaderDialogObj != "undefined") {
42
		loaderDialogObj.modal('hide');
45
		loaderDialogObj.modal('hide');
-
 
46
		$('div.modal-backdrop.fade').remove();
-
 
47
	}
43
});
48
});
44
function ajaxStartHandler() {
49
function ajaxStartHandler() {
45
	if (typeof loaderDialogObj != "undefined")
50
	if (typeof loaderDialogObj != "undefined")
46
		loaderDialogObj.modal('show');
51
		loaderDialogObj.modal('show');
47
	if (typeof isInvestmentOk != "undefined" && !isInvestmentOk
52
	if (typeof isInvestmentOk != "undefined" && !isInvestmentOk
Line 256... Line 261...
256
			} else {
261
			} else {
257
				xhttp.responseType = "text";
262
				xhttp.responseType = "text";
258
			}
263
			}
259
		} else if (xhttp.readyState === 4 && xhttp.status === 200) {
264
		} else if (xhttp.readyState === 4 && xhttp.status === 200) {
260
			// Trick for making downloadable link
265
			// Trick for making downloadable link
261
			if (typeof loaderDialogObj != "undefined")
266
			if (typeof loaderDialogObj != "undefined") {
262
				loaderDialogObj.modal('hide');
267
				loaderDialogObj.modal('hide');
-
 
268
				$('div.modal-backdrop.fade').remove();
-
 
269
			}
-
 
270
			
263
			a = document.createElement('a');
271
			a = document.createElement('a');
264
			a.href = window.URL.createObjectURL(xhttp.response);
272
			a.href = window.URL.createObjectURL(xhttp.response);
265
			// Give filename you wish to download
273
			// Give filename you wish to download
266
			a.download = fileName;
274
			a.download = fileName;
267
			a.style.display = 'none';
275
			a.style.display = 'none';
268
			document.body.appendChild(a);
276
			document.body.appendChild(a);
269
			a.click();
277
			a.click();
270
		} else if (xhttp.readyState == 4 && xhttp.status === 400) {
278
		} else if (xhttp.readyState == 4 && xhttp.status === 400) {
271
			if (typeof loaderDialogObj != "undefined")
279
			if (typeof loaderDialogObj != "undefined") {
272
				loaderDialogObj.modal('hide');
280
				loaderDialogObj.modal('hide');
-
 
281
				$('div.modal-backdrop.fade').remove();
-
 
282
			}
273
			badRequestAlert(xhttp);
283
			badRequestAlert(xhttp);
274
		} else if (xhttp.readyState == 4 && xhttp.status === 500) {
284
		} else if (xhttp.readyState == 4 && xhttp.status === 500) {
275
			if (typeof loaderDialogObj != "undefined")
285
			if (typeof loaderDialogObj != "undefined") {
276
				loaderDialogObj.modal('hide');
286
				loaderDialogObj.modal('hide');
-
 
287
				$('div.modal-backdrop.fade').remove();
-
 
288
			}
277
			internalServerErrorAlert(xhttp);
289
			internalServerErrorAlert(xhttp);
278
		}
290
		}
279
	};
291
	};
280
	// Post data to URL which handles post request
292
	// Post data to URL which handles post request
281
	xhttp.open(httpType, urlString);
293
	xhttp.open(httpType, urlString);