乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      jQuery Ajax jsonp實(shí)現(xiàn)跨域請求(jQuery給出的默認(rèn)方法)

       明天網(wǎng)吧 2015-07-17

      <!--html 代碼清單:

      [html] -->


      */

      <html>
      <head>
      <meta http-equiv="content-type" content="text/html;charset=utf-8">
      <script src="jquery-1.7.min.js"></script>


      <script type="text/javascript">
      $(function(){
      $.ajax({data:{"code":200},
        type: "get",
          url:"http://ttzz.:9090/b.php",
        dataType: "jsonp",
         jsonp:"call",
        //jsonpCallback:"fn",   //這行注釋掉了,使用jQuery給出的默認(rèn)方法
         success:function(res){//res是json類型;
         alert(res.name);
         }
      });
      });
      //function fn(data){alert(data);}
      </script>
      </head>

      <body>
      </body>
      </html>

      **********服務(wù)端b.php 代碼清單:*********

      *********[php] *********************************/

      <?php
      header('Content-Type:text/html;Charset=utf-8'); 
      $code = $_GET['code'];  //傳過來的數(shù)據(jù)

      $call = $_GET['call'];  //傳過來的函數(shù)名,有可能是自定義,也有可能是jQery系統(tǒng)定義的。
      $json_data='{"name":"li"}'; //正確的寫法
      // 正確的寫法  $json_data='"zifuchang"';  單引號里面是雙引號,最里面是字符
      //錯誤的寫法  $json_data="zifuchang";    正常的字符串寫法,錯誤!
      $json_data='{"name":"li"}';
        $res=$call. "(".$json_data.")";  

      echo $res;  
      ?>



        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多