相关疑难解决方法(0)

jQuery ajax调用REST服务

我正在尝试从jquery到休息服务进行ajax调用.使用的其他服务正是来自mkyong博客的教程,这个:http://www.mkyong.com/webservices/jax-rs/integrate-jackson-with-resteasy/

该服务有效,但是当我尝试从jQuery调用时,在Firebug中有200个状态代码,但在响应部分中没有任何内容.

这是带有ajax调用的html页面:

<html>
<head>
    <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
</head>

<body>  

<button id="ajax">ajax call</button>
<button id="json">json</button>

<script type="text/javascript">
    $('#json').click(function(){ 
        alert('json');
         $.getJSON("http://localhost:8080/restws/json/product/get",
         function(data) {
            alert(data);         
          });   
    });

    $('#ajax').click(function(){ 
        alert('ajax');
         $.ajax({ 
             type: "GET",
             dataType: "json",
             url: "http://localhost:8080/restws/json/product/get",
             success: function(data){        
                alert(data);
             }
         });
    });

</script>



</body>

</html>
Run Code Online (Sandbox Code Playgroud)

我无法弄明白我哪里出错了,你能不能告诉我我做错了什么?

谢谢!

rest jquery

48
推荐指数
1
解决办法
25万
查看次数

标签 统计

jquery ×1

rest ×1