Connecting Tech Pros Worldwide Forums | Help | Site Map

Evaluate login result and do something...

Member
 
Join Date: Dec 2008
Posts: 38
#1: Sep 11 '09
Hello again Bytes and TGIF!

I've got an index page (text version) that has a login form with data being sent to a file called pwcheck.php (txt version)

With a good login the success message is being displayed correctly but I need to then reload the index page.

However I do not need to reload index if the login fails, instead report the failure and simply clear the form fields for another try.

How does one evaluate the response from pwcheck.php and act differently based on the html data returned?

Please excuse my code, I'm sure it's sub-par, but I'm java-rookie-supreme with tons more questions than answers.

Respectfully,
Aaron

acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,586
#2: Sep 12 '09

re: Evaluate login result and do something...


If you're going to reload the page on success, why not do away with Ajax?

To evaluate the result, get the responseText and check its content. You can code your server-side code to return a particular response for failure which you can check for.
Member
 
Join Date: Dec 2008
Posts: 38
#3: Sep 12 '09

re: Evaluate login result and do something...


Let me move the htaccess file out of the way again so it's visible.

I prefer to keep it as seamless as possible acoder.

Ultimately I'd like to login, evaluate for success and if good, load/show the large data table (#entrytext) table under the (#onshdr)

I guess by using the post method I'm not going to achieve that?
Is that also is contributing to the loading image being useless right now?

user credentials: tmp:tmp

Regards,
Aaron
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,586
#4: Sep 14 '09

re: Evaluate login result and do something...


Since you're using jQuery, check out the documentation on Ajax.
Reply


Similar JavaScript / Ajax / DHTML bytes