0

I checked the following questions in case this is a duplicate, but they do not answer my question:

get-data-from-url

how-can-i-get-query-string-values

can-i-use-jquery-to-do-get-method-look-at-files-url

Those questions is about retrieve url by javascript. In this case is in PHP.

goServer({
    url: 'checkuser.php?name='+name+'&password' + psw,
    method: 'GET'
});

Everything goes fine, response fine. Except when in the target file (checkuser.php):

$name = $_GET['name']'; (also for other params)

it occurs error/warning that there is no index 'name' or 'password' in the $_GET variables.

Question: how to get URL data when ajax method is "GET" ?

Thank you

(OH MY.. Stupid error. It sent in GET but written in target file $_POST['name'])

3
  • 1
    can you post results of print_r($_GET) Commented Jun 18, 2013 at 1:59
  • 1
    don't delete questions it affects you negatively. Commented Jun 18, 2013 at 2:14
  • Don't delete questions, others can learn from it! Commented Jun 18, 2013 at 2:23

2 Answers 2

2

do both fail? You need "password=" not just "password" in your URL

also you have an extra ' in your GET statement. should be $_GET['name'];

Sign up to request clarification or add additional context in comments.

Comments

1

Your code should be this:

goServer({
    url: 'checkuser.php?name='+name+'&password=' + psw,
    method: 'GET'
});

$name = $_GET['name'];

2 Comments

your answer has part of his question
I forgot to check source in my file. The stupid is, it sent by GET, by i receive by POST.. Oh my,,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.