-4

Good day to all!

I am seeking help with this link given http://dtcwebmedia.com/cms/bridegal/api/get_category_posts?id=96

Can anyone teach me how to parse and display this using html , im having hard time displaying it or maybe retrieving it.

i've tried different tutorials but it seems im having a hard time displaying it. can anyone help me?

heres the code

<!DOCTYPE html>
<html>
<body>

<div id="id01"></div>

<script>
var xmlhttp = new XMLHttpRequest();
var url = "http://dtcwebmedia.com/cms/bridegal/api/get_category_posts?id=96";

xmlhttp.onreadystatechange = function() {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        var myArr = JSON.parse(xmlhttp.responseText);
        myFunction(myArr);
    }
}
xmlhttp.open("GET", url, true);
xmlhttp.send();

function myFunction(arr) {
    var out = "";
    var i;
    for(i = 0; i < arr.length; i++) {
        out += arr[i].status + 
        arr[i].count + '</a><br>';
    }
    document.getElementById("id01").innerHTML = out;
}
</script>

</body>
</html>

i appreciate your help, thank you

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335

1 Answers1

-1

Try this way.. this may help you..

$json = "JSONSTRINGRESPONSE";
$json = json_decode($json, true);

echo $json['status'];
echo $json['count'];
echo $json['pages'];
echo $json['category']['id'];
... 
echo $json['category']['post_count'];
and so on..
Pragnesh Ghoda シ
  • 8,318
  • 3
  • 25
  • 40