

$( document ).ready(function() {

	$('#approve_identity').click(function(event){

		event.preventDefault();

		$("#errorPrompt").hide();
		$("#errorPrompt").html("");

		$('#approve_identity').attr("disabled", "");

		$(".button_spinner").show();

		var form_data ="";

		$.ajax({
			url: "../admin-helpers/admin_approve_identity",
			type: "POST",
			data: form_data,

		}).done(function(response) {

			$("#approve_identity").removeAttr("disabled");
			$(".button_spinner").hide();

			$("#errorPrompt").show();

			if (response == "success") {
				window.location.href="identity-verification";
			}else {
				$("#errorPrompt").html('<div class="alert alert-danger" role="alert">'+ response + '</div>');

				$('html, body').animate({
					scrollTop: $("#top_area").offset().top
				}, 500);
			}

		});

		return false;
	});
});