Тема: Getting Json request to work

Hi,

I want to provide to users a simple method to check if they have currently signup.
To achieve this i'm using a json request that will get the page and show only the elements i want.

Below is a generic json request script that i have use in the past for lists.

<script>
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
        var myObj = JSON.parse(this.responseText);
      document.write('<center><table><tr><td>');
      for (x in myObj.matches) {

      document.write(''+ myObj.matches[x].ip_str +'<br>');
}
      document.write('</td></tr></table></center>');
}
};
xmlhttp.open("GET", "https://www.example.com", true);
xmlhttp.send();
</script>

I want to use the code above to get the code below and only show some elements

[{"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"}]

I just want to show the user some elements like ip, earn, ddate and country.

Thanks

2

Re: Getting Json request to work

Could anyone shed some light on how to make it work?

I just need the right json method.

Thanks