jsonp客戶端調用示例

<html>
 <head>
  <title>testJSONP</title>
  <script type="text/javascript" src="jquery.js"></script>
  <script>

  $.ajax({
        dataType: 'jsonp',
        data: encodeURI(encodeURI("callback=call2&data=" + '{"key1":"value1","key2":"value2"}')),
        jsonp: 'jsonp_callback',
        url: 'http://ip:port/projectname/servicename',
        success: function ()
        {
        },
    });

   
  function call2(resp){
    alert("responseCode:" + resp.responseCode + ";responseDesc:" + resp.responseDesc );
  }

  </script>
 </head>
 <body>
 </body>
</html>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章