function userCreate() { var action = "http://localhost:8080/api/users"; var postData = {}; postData.mail = $('#createEmail').val(); postData.user = $('#createUsername').val(); postData.first = $('#createFirst').val(); postData.last = $('#createLast').val(); $.post(action, postData, function (data) { console.log("In post cb", data) if (data.error) { $('.alert').html(data.error); $('.alert').alert(); } }, 'json'); } $(document).ready(function () { // $('.alert').alert('close'); });