<script type="text/javascript"> // This is our function to be called with JSON data function tet(data) { alert("ty: " + data.a + ", tr: " + data.b); } var url = "http://ganbaobao.com.cn/test.php?callback=tet"; // URL of the external script // this shows dynamic script insertion var script = document.createElement('script'); script.setAttribute('src', url); // load the script document.getElementsByTagName('head')[0].appendChild(script); </script>
$prot = array('a'=>'121abc','b'=>'11a1b12c','c'=>'11assbc','d'=>'11ffgaerbc','e'=>'11adsabc');
$json = JSON($prot);
echo $_GET['callback'].'('.$json.')';