/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] AJAX & PHP – responseText question.

I’m using AJAX to send login information to my login.php script. I’m doing this so that error messages such as “incorrect password” can be written to the page without the need to refresh the page or go to another page.

My problem is, when the users username and password match, I’m using the following code to send the user to another page:

header(“Location: secure.php”);

Instead of redirecting the user, AJAX is reading the output of secure.php as responseText and writing it to the page, obviously not the result I was looking for.

Any suggestions?

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@ratcatemeNov 07.2008 — if you made the response into a XML response you could add a flag say good or bad

if good use javascript for the redirect

if bad get the next xml element that would be the error text

if you dont really understand XML and javascript i would recommend looking at xajax its fast and simple

Scott.
×

Success!

Help @robmarston spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...