$(document).ready(function()
{   
    $("#invite-form").on('submit', function()
    {   
        var inviteeEmail = $("#email").val();
        console.log(inviteeEmail)

        if (!inviteeEmail || !inviteeEmail.length) {
            alert('Please enter an email');
            return false;
        }

        $.ajax({
          type: "POST",
          url: "/",
          headers: {
            'X-CSRFToken': csrfToken,
            },
          data: { email: inviteeEmail},
          success: function(data) {
            handleResponse(data);
          }
        });
        return false;
    });        
});

function handleResponse(data) {
    document.data = data
    if (data.status === 'success') {
      console.log('success')
    }
    if (data.status === 'fail') {
      console.log('failed')
    }
}
@@ -732,16 +732,58 @@
 ccess')%0A
+      Materialize.toast('Success!', 4000)%0A
     %7D%0A  
@@ -824,28 +824,42 @@
     
-console.log('failed'
+Materialize.toast(data.error, 4000
 )%0A  

Use Materialize toasts to show the status