jalder85 Posted September 13, 2009 Share Posted September 13, 2009 Hello, I am trying to put together a jquery post based login form. While the form does post, none of the data portion of the jquery post get executed. If I manually refresh the page after submitting, I am successfully logged in to WHMCS, so that proves that it is posting, but I cannot figure out while none of the function(data) is working. $('#accntlogin').submit(function(){ $.post('/clients/dologin.php', $('#accntlogin').serialize(), function(data){ if(data){ $('#loginform').html(data); } else{ $('#forgotpass').show(); $('#forgotpass').css('color', 'red'); } }, 'html'); return false; }); Any ideas? Thanks, jalder 0 Quote Link to comment Share on other sites More sharing options...
jalder85 Posted September 15, 2009 Author Share Posted September 15, 2009 Little bit of an update: Well I found out the reason the post request from jquery isn't coming back successful is because WHMCS is kicking a 302 redirect no matter the query results. So this raises 2 questions: 1. Why isn't post following the redirect for the content? 2. How can I read the full response headers from the post? Jalder 0 Quote Link to comment Share on other sites More sharing options...
jalder85 Posted September 20, 2009 Author Share Posted September 20, 2009 Finally figured out the cause. The WHMCS login was looking for an https login request only. The development website was not operating under https. Once I forced the redirect to a https connection, the login function worked and the returned data was the redirected page after login instead of the fail. I added some logic to the ajax request and tested the returned data if it contained the loginform or not (if it contained the login form, this would mean that the credentials were bad obviously). I then either loaded the account menu or displayed text to the user that the login was invalid. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.