my $json = JSON->new->utf8->encode($data); my $q = $self->query; print $q->header( -type => 'application/json', -charset => 'utf-8', ); print $json; $self->session->flush if $self->can('session') && $self->session_loaded; # Absolutely murder the rest of the call stack exit; # OR die if mod_perl yells at exit() ####
Content-Type: application/json

{"abbr":"Btest","companyid":7,"email":"bjp@example.com","_resume":"null","name":"Brandon Test","success":1,"userid":1234}{
   "error" : "API Error. ModPerl::Util::exit: (120000) exit was called at /var/www/html/testapp/TestTracker/Api.pm line 1005",
   "event_threadid" : 21169609
}
##
## $('#twofactor_form').on('submit', function(event) { var formData = $('#twofactor_form').serialize(); event.preventDefault(); $.ajax({ url: 'api/userLogin', method: 'POST', data: JSON.stringify(formData), dataType: 'json', beforeSend: null, error: function(event) { alert(event.responseJSON.error); //debugger; }, success: function(data) { //Note this never gets tripped ever. //It never reaches the success or failure state, it just spits out that raw html and my url points to the api.pm path. if ( data._resume ) { //console.log("2FA _resume hit"); var resume = JSON.parse(data._resume); window.location.replace(resume.url); } else { //console.log("2FA no-resume hit"); window.location.replace(BASE_URL); } } }); return false; });