For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Thursday, October 10, 2013

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 . ');';
?>
Share:

0 comments:

Post a Comment

How to make center align child div

 How to make center align child div?   Suppose you have 2 Div tag. And want the make inner tag center <div id="d1">      ...

Ads Inside Post

Powered by Blogger.

Arsip

Blog Archive