I'm trying to get json from wcf rest service and I getting json, but with *invalid label* , I've tried the callback wrapper but still getting the same error message here is the code
<html>
<head>
<script src="js/jquery-1.5.min.js"&g开发者_如何学运维t;</script>
<script type="text/javascript">
var JSONCall = function(_url,callback)
{
$.ajax({
type: "GET",
cache: false,
url: _url,
data: '{}',
contentType: "application/javascript",
dataType: "jsonp",
success: function(result) {
alert('sfss');
//console.log(result);
callback(result);
},
error: function (data, status, e)
{
alert("EError:"+e);
}
});
};
/*GET ALL DATA*/
//invalid label to Rest Service jsonp
function getAllData()
{
JSONCall('http://svc.somedomain.com/RestServiceImpl.svc/?callback=?',function(data){
console.log(data);
});
}
</script>
</head>
<body>
<input type="button" value="Get Json" onclick="getAllData()" />
</body>
</html>
How can I get proper response, thanks
精彩评论