Front-end requester: Copy code The code is as follows: $(function() { $ .getJSON('http://test.com/aa.php?callback=?',{classid:1,num:2},function(json){ alert(json.key); }); }); < ;/script> <br> </div> <br>Requested end: <br><div class="codetitle"> <span style="CURSOR: pointer" onclick="doCopy('code40204')"><u>Copy code</u></span> The code is as follows:</div> <div class="codebody" id="code40204"> <br>$ classid=$_GET['classid']; <br>$num=$_GET['num']; <br>if($classid&&$num){$results = array("key" => "value") ; echo $_GET['callback'] . '(' . json_encode($results) . ')'; } <br> </div> <br>The key is that the callback variable must bring the callbak value when outputting json data Only if they are consistent can getJSON be successful, otherwise no operations within function(json) {…} will be executed <p align="left"></p> <div style="display:none;"> <span id="url" itemprop="url">http://www.bkjia.com/PHPjc/313631.html</span><span id="indexUrl" itemprop="indexUrl">www.bkjia.com</span><span id="isOriginal" itemprop="isOriginal">true</span><span id="isBasedOnUrl" itemprop="isBasedOnUrl">http: //www.bkjia.com/PHPjc/313631.html</span><span id="genre" itemprop="genre">TechArticle</span><span id="description" itemprop="description">Front-end requester: Copy the code as follows: script $(function() { $.getJSON('http:/ /test.com/aa.php?callback=?',{classid:1,num:2},function(json){ alert(json.key); }); }); /script...</span> </div> <div class="art_confoot"></div>