Server side:
....
$_SESSION[\'accountId\'] = $accountId;
$_SESSION[\'type\'] = $_POST[\'accountType\'];
echo \'1\';
return;
<
There are more useful parameters to the error callback. Try getting the textStatus.
error: function(XHR, textStatus, errorThrown) { console.log(textStatus); }
Check what that is.
A quick guess is that you meant to use dataType: 'text'
not 'text/plain'
. (Check documentation)
$.ajax({
type:'POST',
data: $("#flowFormSubmit").serialize(),
dataType:'text',
timeout:1000,
success:function(response){
if(-1 == response)
alert('fail');
else
alert('succeed');
}
});