SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Lagos,Nigeria
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Load a page using ajax

    I have a login page which authenticate users using php and mysql. If the authentication is successful, it redirects the user to another page. This is working as it should but instead of the page refreshing when it redirects, I want to use Ajax to load the page. I have tried doing this without any luck. Could someone direct me on how to go about this?

    Thanks

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I can't, but I don't understand what's wrong with just refreshing the page? It's not annoying or anything and doesn't require javascript to be on.

  3. #3
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Lagos,Nigeria
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't understand you. An example of what I want is the google logon page. It loads the page after a successful logon.

  4. #4
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Yes... I don't see where Ajax fits into that.

    Example:
    • login.php: page with login form. The form has the action attribute set to go to itself.
    • login.php processes the information behind the scenes. If the information is correct, it redirects to index.php (homepage) along with session information. If incorrect, redirects back to login.php along with an error message

  5. #5
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Lagos,Nigeria
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Raffles for the response. Am new to Ajax and I was wondering if I can do that with Ajax.

  6. #6
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I'm sure you can, but I don't see the point. And especially if you're new to Ajax, you'd probably end up exposing security holes.

  7. #7
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Lagos,Nigeria
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Got the message. Thanks

  8. #8
    SitePoint Zealot
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    137
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The Google login page uses a bit of AJAX but does involve a page refresh on successful login. The google page is secure is that they use SSL for an encrypted connection. You would need to use a client side hashing function with JavaScript - google 'md5 javascript' - and submit the login form via AJAX to the server, with the server sending back cookie headers and a notice as to whether the client was authenticated or not. Take a look at my recent article on AJAX with jQuery for some pointers and feel free to contact me if you have any questions.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •