Login Register


Getting Json request to work filter_list
Author
Message
RE: Getting Json request to work #11
(04-09-2018, 08:40 PM)Pikami Wrote: It won't be the case, I used this API in my site 2 weeks ago: http://quotes.rest/
It worked, but I used fetch() instead of XMLHttpRequest

Can you provide a code sample?

Reply

RE: Getting Json request to work #12
(04-10-2018, 02:56 PM)hacxx Wrote:
(04-09-2018, 08:40 PM)Pikami Wrote: It won't be the case, I used this API in my site 2 weeks ago: http://quotes.rest/
It worked, but I used fetch() instead of XMLHttpRequest

Can you provide a code sample?

sure
Code:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css"> </head> <body> <div class="container"> <h1 id="demo">place holder</h1> </div> <script> fetch('https://jsonplaceholder.typicode.com/comments?postId=1') .catch(function(myJson) { document.getElementById("demo").innerHTML = "Oh no! Some shit happened :("; }) .then(function(response) { return response.json(); }) .catch(error => console.error('Error:', error)) .then(function(myJson) { console.log(myJson); document.getElementById("demo").innerHTML = myJson[0].body; }); </script> </body> </html>

Reply

RE: Getting Json request to work #13
Okay, this might be a stupid question, but I'm here to learn, and this is an opportunity for someone to feel like they're contributing to the community...
My question is, what would you use json requests for, and what languages could you use them with?

Edit: Even if someone made a thread on it, that'd be nice.
(This post was last modified: 04-10-2018, 06:07 PM by Synthx.)
[Image: ezgif_com_gif_maker.gif]
#yellowheartsforsarah

Reply

RE: Getting Json request to work #14
(04-10-2018, 06:07 PM)Synthx Wrote: Okay, this might be a stupid question, but I'm here to learn, and this is an opportunity for someone to feel like they're contributing to the community...  
My question is, what would you use json requests for, and what languages could you use them with?

Edit: Even if someone made a thread on it, that'd be nice.

json is mostly used while communicating with an API
Example: you have some reactive web page where you need to reload data every few seconds, you don't want to reload the whole page, so you use javascript to get that data trough an API and update just that.
There are many more use cases, this is only one example. If you have enough interest in this or want to learn more you can always PM me Smile

Reply

RE: Getting Json request to work #15
(04-10-2018, 06:18 PM)Pikami Wrote:
(04-10-2018, 06:07 PM)Synthx Wrote: Okay, this might be a stupid question, but I'm here to learn, and this is an opportunity for someone to feel like they're contributing to the community...  
My question is, what would you use json requests for, and what languages could you use them with?

Edit: Even if someone made a thread on it, that'd be nice.

json is mostly used while communicating with an API
Example: you have some reactive web page where you need to reload data every few seconds, you don't want to reload the whole page, so you use javascript to get that data trough an API and update just that.
There are many more use cases, this is only one example. If you have enough interest in this or want to learn more you can always PM me Smile

Thanks man, I am interested, but I'll PM you sometime within the next month or so about it. Unless I forget, lol.
[Image: ezgif_com_gif_maker.gif]
#yellowheartsforsarah

[+] 1 user Likes Synthx's post
Reply

RE: Getting Json request to work #16
(04-09-2018, 02:00 PM)hacxx Wrote:
Code:
[{"banner_type":null,"id":"2162875","campid":"8909","ip":"154.69.47.83","subid":"","subid2":"","subid3":"","earn":"300.0","ddate":"2018-04-05","dtime":"02:36:11","ustamp":1491377771,"preid":null,"gateid":"1310615","country":"US","currency":"USD","banner_id":"0","type":"CPC"}, {"banner_type":null,"id":"2155364","campid":"10357","ip":"111.125.111.139","subid":"","subid2":"","subid3":"","earn":"0.80","ddate":"2018-04-04","dtime":"08:29:26","ustamp":1491312566,"preid":null,"gateid":"1310615","country":"PH","currency":"USD","banner_id":"0","type":"CPC"}]

Dear god PLEASE format that....

(04-10-2018, 06:18 PM)Pikami Wrote:
(04-10-2018, 06:07 PM)Synthx Wrote: Okay, this might be a stupid question, but I'm here to learn, and this is an opportunity for someone to feel like they're contributing to the community...  
My question is, what would you use json requests for, and what languages could you use them with?

Edit: Even if someone made a thread on it, that'd be nice.

json is mostly used while communicating with an API
Example: you have some reactive web page where you need to reload data every few seconds, you don't want to reload the whole page, so you use javascript to get that data trough an API and update just that.
There are many more use cases, this is only one example. If you have enough interest in this or want to learn more you can always PM me Smile

I disagree. JSON is an encoding used to describe an object. It doesn't need to be used with an API, in fact many NoSQL implementations use it. It can be helpful when you want to describe something in a user-readable format, rather than using a plist. It can also be nice if you are creating software configuration schemas and you don't want the user to have to specify all of the variables.

Reply

RE: Getting Json request to work #17
(04-11-2018, 12:49 AM)phyrrus9 Wrote:
(04-09-2018, 02:00 PM)hacxx Wrote:
Code:
[{"banner_type":null,"id":"2162875","campid":"8909","ip":"154.69.47.83","subid":"","subid2":"","subid3":"","earn":"300.0","ddate":"2018-04-05","dtime":"02:36:11","ustamp":1491377771,"preid":null,"gateid":"1310615","country":"US","currency":"USD","banner_id":"0","type":"CPC"}, {"banner_type":null,"id":"2155364","campid":"10357","ip":"111.125.111.139","subid":"","subid2":"","subid3":"","earn":"0.80","ddate":"2018-04-04","dtime":"08:29:26","ustamp":1491312566,"preid":null,"gateid":"1310615","country":"PH","currency":"USD","banner_id":"0","type":"CPC"}]

Dear god PLEASE format that....

(04-10-2018, 06:18 PM)Pikami Wrote:
(04-10-2018, 06:07 PM)Synthx Wrote: Okay, this might be a stupid question, but I'm here to learn, and this is an opportunity for someone to feel like they're contributing to the community...  
My question is, what would you use json requests for, and what languages could you use them with?

Edit: Even if someone made a thread on it, that'd be nice.

json is mostly used while communicating with an API
Example: you have some reactive web page where you need to reload data every few seconds, you don't want to reload the whole page, so you use javascript to get that data trough an API and update just that.
There are many more use cases, this is only one example. If you have enough interest in this or want to learn more you can always PM me Smile

I disagree. JSON is an encoding used to describe an object. It doesn't need to be used with an API, in fact many NoSQL implementations use it. It can be helpful when you want to describe something in a user-readable format, rather than using a plist. It can also be nice if you are creating software configuration schemas and you don't want the user to have to specify all of the variables.

I made a mistake, thanks for correcting me, I didn't state that it "needs" to be used with an API tho.

Reply

RE: Getting Json request to work #18
(04-10-2018, 06:18 PM)Pikami Wrote:
(04-10-2018, 06:07 PM)Synthx Wrote: Okay, this might be a stupid question, but I'm here to learn, and this is an opportunity for someone to feel like they're contributing to the community...  
My question is, what would you use json requests for, and what languages could you use them with?

Edit: Even if someone made a thread on it, that'd be nice.

json is mostly used while communicating with an API
Example: you have some reactive web page where you need to reload data every few seconds, you don't want to reload the whole page, so you use javascript to get that data trough an API and update just that.
There are many more use cases, this is only one example. If you have enough interest in this or want to learn more you can always PM me Smile

One should note that while it is often used for APIs, it is also used a lot for configuration files and data storage.


(11-02-2018, 02:51 AM)Skullmeat Wrote: Ok, there no real practical reason for doing this, but that's never stopped me.

Reply







Users browsing this thread: