$(document).ready(function(){
  $("#btnSubmit").click(function (){
      if($("#txt_email").val() == ''){
	  $("#msg").html("<span class='error'>Please enter the email address</span>");
	  $("#txt_email").focus();
      }else{
	 $("#msg").html("&nbsp;");
	 $.ajax({
	    type: "POST",
	    url: "/save_newsletter.php",
	    data: "email=" + $("#txt_email").val(),
	    success: function(msg){
	      if(msg != 1){
		$("#msg").html("<span class='error'>" + msg + "</span>");
	      } else if(msg == 1){
		$("#txt_email").val('');
		$("#msg").html("<span class='successfull'>You are successfully subscribed...</span>");
		
	      }
	    }
	  });
      }
  });
});


