taffarel taffarel - 3 months ago 25
jQuery Question

checking out the login result

I am trying to integrate cpanel to my cms...
I have this code to remote logins:

<form action=’http://www.yourdomain.com:2082/login/’ method=’post’>
<table border=’1′ width=’250′ cellpadding=’2′ cellspacing=’0′>
<td align=’right’>Username:</td>
<td><input type=’text’ name=’user’></td>
<td align=’right’>Password:</td>
<td><input type=’password’ name=’pass’></td>
<td colspan=’2′ align=’center’><input type=’reset’ name=’r1′ value=’Reset’><input type=’submit’ name=’s1′ value=’Login’></td>

This form loads cpanel after successful login. I don't want this form to loads cpanel after successful login. I want to load another page of my cms after successful login. So, I would like to check if login is successful or not. I tried to do it with jquery however jquery did not work on cross domain. Does anyone got any suggestion for this situation?


One way to accomplish this would be to use AJAX to submit the form. This way the user is logged in and the cookie is sent to the browser, but the page that is normally shown after successful login won't be displayed.

In your JavaScript you will need to search the xmlHttp.responseText for success and failure texts. For example, if a failed login will produce the text "Invalid username or password", use that as a fail text to search for. If there is something similar that would indicate a successful login, search the text for that. If it is successful, use javascript to forward the browser to your own special logged in page. If not, send an error back to the user.

Edit: I missed the part about it being cross-domain. You can use JSONP for that apparently.