Reputation: 105
I have created a php script that I know works. I try communication to it with the following ajax call:
var request = new XMLHttpRequest();
request.open("GET", "http://larsbak.dk/schedule/GET/schedule.php");
request.setRequestHeader("Content-type", "application/json");
request.onreadystatechange = function () {
if (request.readyState == 4 && request.status == 200) {
data = JSON.parse(request.responseText);
}
request.send("id=201303560&interval=100000");
When i use the above script the server respons with error with error 104, which means that id parameter is not set. Why is this happening?
Upvotes: 0
Views: 29
Reputation: 943537
"POST"
or move the data to the query string."application/json"
, which "id=201303560&interval=100000"
is not. You are sending "application/www-x-form-urlencoded"
data.}
) your onreadystatechange
handlerUpvotes: 3