Ads Inside Post

Search in This Blog

JSON in PHP Simple

Simple JSON in PHP

test.php
<script type="application/javascript">
function getip(json){
    alert(json);
}
</script>
<script type="application/javascript" src="http://localhost:90/test/a1.php?callback=getip"></script>


a1.php
<?php
header('content-type: application/json; charset=utf-8');

$data = json_encode($_SERVER['REMOTE_ADDR']);
echo $_GET['callback'] . '(' . $data . ');';
?>