Recent Posts

Caution: Greetings to all visitors. The site is working in short. Links Please skip the link to view any topic and thank you for visiting
header ads

How to get data from this ajax call

Hi guys,
I retrieved data from server with the ajax method but I don't know how to extract this data out of response text to use it somewhere else.
Any suggestions how to do this would be greatly appreciated.

fetch("/path_to_file/data.json").then(response => {
    return response.text();
}).then(data => {
    if(data) {
        var foo = JSON.parse(data);
        console.log(data); // {"key1":"value1","key2":"value2"}
        retrieveData(foo.key1,foo.key2);
    }
});
function...
Code (markup):
How to get data from this ajax call

from JavaScript https://ift.tt/2uVlEP4
via IFTTT

Post a Comment

0 Comments