</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.2/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>


<script>
  function sendmail(title,username,status,email,user_id,document_id){
     $('#Emailsend'+user_id).text('Sending...!'); 
    $.ajax({
    type: 'POST',
    url: 'sendemail.php',
    data: {
        title: title,
        username: username,
        status: status,
        email: email,
        user_id: user_id,
        document_id: document_id
    },
    dataType: 'json',
    success: function(response) {
        $('#Emailsend'+user_id).text('Sent..!'); 
        setTimeout(() => {
            $('#Emailsend'+user_id).text('Email'); 
        }, 2000);
      if(response.status===200){

		swal(
				'Success',
				 response.message,
				'success'
			)
		
      }else{
        
		swal(
				'Error',
				 response.message,
				'error'
			)
      }
    },
    error: function(xhr, status, error) {
        console.log("Error:", error);
        console.log("XHR Response:", xhr.responseText); 
    }
});



  }  
    </script>
</body>
</html>
