JSONP 를 사용 하여 도 메 인 데이터 호출 을 실현 합 니 다.

<script type="text/javascript" src=jquery.min.js"></script> <script type="text/javascript"> jQuery(document).ready(function(){ 
        $.ajax({
             type: "get",
             async: false,
             url: "http://flightQuery.com/jsonp/flightResult.aspx?code=CA1998",
             dataType: "jsonp",
             jsonp: "callback",//             ,    jsonp         
                                (     :callback)               jsonpCallback:"flightHandler",//    jsonp      ,   jQuery          
                                            ,    "?",jQuery                        success: function(json){
        alert('        :  : ' + json.price + '  ,  : ' + json.tickets + '  。'); },
             error: function(){
                 alert('fail');
             }
         });  });  </script>        ?         flightHandler     ?            !  ,   jQuery    ,jquery   jsonp   ajax  (       ,  jquery  jsonp    ajax,             ),                   success       ,      ? 

좋은 웹페이지 즐겨찾기