Return to Snippet

Revision: 52244
at October 18, 2011 03:42 by vitorbari


Initial Code
$.ajax({
	url: '',
	type: 'POST',
	dataType: 'json',
	data: {},
	beforeSend: function(){
		$('#load-msg').show();
	},
	success: function(data) {
		$('#load-msg').hide();
		if(data.errorStatus){
			alert(data.errorMsg || 'An error has occurred');
		}else{
			// do stuff
		}
	},
	error: function() {
		$('#load-msg').hide();
		alert('An error has occurred');
	}
});

Initial URL

                                

Initial Description

                                

Initial Title
jQuery Ajax Error Handling

Initial Tags
ajax, javascript, jquery

Initial Language
jQuery