当我尝试从jsonp执行REST WCF服务时,我得到了javascript错误。
网页错误详细信息
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2)时间戳:清华,2013 -03-07 09:00:24 UTC
Message: Expected ';'
Line: 1
Char: 22
Code: 0
URI: https://google.com/ISCSOrderList/OrderListService.svc/RestService/GetOrderList?request=B36733DC-6DB5-4FB6-9A63-B25CE858CA28;FR;2010-06-27;2010-10-05&callback=jsonp1362646767878&_=1362646774807我使用了以下代码:
<script type="text/javascript">
function GetRestData() {
debugger;
var Guid = $('#txtUserGuid').val();
var CountryCode = $('#txtCountryCode').val();
var FromDate = $('#txtFromDate').val();
var ToDate = $('#txtToDate').val();
//jQuery.support.cors = true;
$.ajax({
url: "https://google.com/ISCSOrderList/OrderListService.svc/RestService/GetOrderList?request=B36733DC-6DB5-4FB6-9A63-B25CE858CA28;FR;2010-06-27;2010-10-05",
dataType: "jsonp",
type: "GET",
jsonpCallback: "MyCallback",
success: function(data, textStatus, jqXHR) {
alert(JSON.stringfy(data));
},
error: function(jqXHR, textStatus, errorThrown) {
alert(JSON.stringfy(errorThrown));
},
complete: function(jqXHR, textStatus) {
alert(JSON.stringfy(jqXHR));
}
});
}
function MyCallback(data) {
alert(JSON.stringfy(data));
}
</script>发布于 2013-03-14 01:50:33
奥普,
您遇到的问题很可能与实际URL/资源中的错误有关。除非我们能复制这个错误,否则我们不能帮你解决它。为代码提供对URL的请求,503的请求不会给我们带来任何好处,而且会让人感到困惑。
您是否可以克隆您的私有资源的一部分,并在敏感信息所在的位置插入虚拟数据?
或者,您可以复制并粘贴您在Line: 1 Char: 22上查看资源时找到的内容吗?为了安全起见,可能需要在前面和后面加几行。
https://stackoverflow.com/questions/15266975
复制相似问题