jsonp客户端调用示例

来源:互联网 发布:windows配置域名 编辑:程序博客网 时间:2024/04/29 12:03

<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>

0 0
原创粉丝点击