AJAX Response Handler

	var params = {
		option_name: 'contacts', 
		option_value: $('#contacts').val()
	}

	$.ajax('services/events/get.php', {
		type: 'POST',
		data: params,
		success: function(data, textStatus, jqXHR){
			if(typeof data.err_code == 'undefined'){
				show_msg('Error', data);
			}else if(data.err_code == null){
				show_msg('Info', 'Registration Completed');
				window.location.href = "index.php";
			}else{
				show_error(data.err_code, data.err);

			}
		},
		error: function(jqXHR, textStatus, errorThrown){
			alert('Error:' + jqXHR.responseText + '; ' + textStatus);
		}
	});

3 thoughts on “AJAX Response Handler

Comments are closed.