function jhfl_subscribe(wpurl, email, nonce){
	jQuery.ajax({
		type: "post",url: wpurl + "/wp-admin/admin-ajax.php", data: { action: 'jhfl_subscribe', _ajax_nonce: nonce , emailaddress: email },
		//beforeSend: function() {jQuery("#loading").show("slow");}, //show loading just when link is clicked
		//complete: function() { jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(data){ //so, if data is retrieved, store it in html
		}
	});
}

jQuery(document).ready(function(){
	jQuery('input#subscribe').click(function() {
		var email = jQuery('input#jhfl_email').val(); 
		if (email == ""){
			alert("Please enter your email");
			return false;
		}
		var is_receive_opt = jQuery('input#jhfl_receive_opt').is(':checked');
		if (is_receive_opt){
			var nonce = jQuery('input#jfhl_nonce').val();
			var wpurl = jQuery('input#jhfl_wpurl').val();
			jhfl_subscribe(wpurl, email, nonce);
		}
		return true;
	})
})