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

Add Dependent Scripts

   here is the code that allow to add dependent script :         <script>         const addDependentScripts = async function( scriptsT...

Ads Inside Post

Powered by Blogger.

Arsip

Blog Archive