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'])

Community
  • 1
  • 1
Bagus Javas
  • 123
  • 3
  • 10

2 Answers2

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'];

75inchpianist
  • 4,112
  • 1
  • 21
  • 39
1

Your code should be this:

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

$name = $_GET['name'];

noahnu
  • 3,479
  • 2
  • 18
  • 40
RussellHarrower
  • 6,470
  • 21
  • 102
  • 204