GET and POST when retrieving data?

I understand that if you pass the get all settings displayed in the browser in the url and in the post - no
I get the json from here and no matter what I use, whether axios orXMLHttpRequest or fetch
the point is that I get using a get request, but in the address bar, nothing.
What I do not understand? And why can't I get through post?
Get so
axios.get('https://jsonplaceholder.typicode.com/users')
 .then(response => {
 this.usersList = response.data
 })

or
//XMLHttpRequest
 let xhr = new XMLHttpRequest()
 xhr.open('GET', 'https://jsonplaceholder.typicode.com/users', false)
xhr.send()

 if(xhr.status === 200) {
 this.httpReq = JSON.parse(xhr.responseText)
 }


If you change to POST nothing works.
March 20th 20 at 11:36
4 answers
March 20th 20 at 11:38
Returns an array of 10 objects as you request data
const response = await fetch("https://jsonplaceholder.typicode.com/users");
const json = await ().json(); // returns an array of 10 objects


Returns {id: 11}, as you send data
const response = await fetch("https://jsonplaceholder.typicode.com/users", {
 method: "POST"
});
const json = await ().json(); // returns {id: 11}


As you can see from the replies, the website jsonplaceholder.typicode.com different handles post and get requests. And once you have errors, then you did not notice, but expect a miracle. So I think the question is closed.

Understand what a REST API, then you will understand the behavior of this service.
March 20th 20 at 11:40
Wang, you have a problem with this.
And what does it mean
GET /posts
GET /posts/1
POST /posts
PUT /posts/1
PATCH /posts/1
DELETE /posts/1
- jaden_Koelpin commented on March 20th 20 at 11:43
March 20th 20 at 11:42
The $_POST gets the fact that we managed to steam if the data is sent, for example, in json, as it does axios, parsite yourself from php://input.
And what does it mean
GET /posts
GET /posts/1
POST /posts
PUT /posts/1
PATCH /posts/1
DELETE /posts/1
- jaden_Koelpin commented on March 20th 20 at 11:45
@Brody.Hue, in the sense that mean? http requests, specifically this set the standard for rest api. - Elissa_Nitzsche89 commented on March 20th 20 at 11:48
@jasen_Feest get in ajax need to get in order to get data and post to write? or what? help. - jaden_Koelpin commented on March 20th 20 at 11:51
@jasen_Feestand vkratse can tell what is rest api - jaden_Koelpin commented on March 20th 20 at 11:54
@Brody.Hue, in short, difficult. There are http requests - GET,POST,PUT,PATCH,DELETE and many other. A REST API is kind of api now understand by the word model described by Leonard Richardson, is the use of http requests and http statuses, and in the path of the request address to a specific entity. For example:
DELETE /post/1 delete the post entity with id=1
GET /posts - get all of the entities post
GET /post/3 - getting the post entity with id=3

Regarding your query in php is poorly supported methods other than GET and POST, so other methods will have to parse the request data. - Elissa_Nitzsche89 commented on March 20th 20 at 11:57
@jasen_Feest,
you will have to parse the request data

type time no DELETE, have to delete and etc? - jaden_Koelpin commented on March 20th 20 at 12:00
@Brody.Hue, you will have to delete, the DELETE is just an http request, in fact a Declaration of intention, the implementation is still on you. (Although frameworks such things can be implemented automatically). I just wrote about parsing the received parameters in the request body, they will need to repassivate yourself, use a variable like $_POST will not work. - Elissa_Nitzsche89 commented on March 20th 20 at 12:03
March 20th 20 at 11:44
I understand that if you pass the get all settings displayed in the browser in the url and in the post - no
the wrong understanding, which leads to errors in the implementation and, accordingly, in the logic of the code.

the point is that I get using the get request, but in the address bar, nothing.
And should not be, as it does to a specific browser is not true, it's more to the protocols, which would be nice to read any novice vibrostability. Address bar, just ONE of the VISUALIZATION tools query, but many programs can do get / post requests without the address bar(without any browser), what should you push for some understanding of the protocols.

And why can't I get through post?

By the fact that it is not stipulated in the IPA?
the wrong understanding, which leads to errors in the implementation and in the code logic

and advise me what to read according to the protocols. And what's the catch then get and post if not in the address bar? - jaden_Koelpin commented on March 20th 20 at 11:47

Find more questions by tags AJAXJavaScript