I am getting javascript error when I try to execute REST WCF Service from jsonp.
Webpage error details
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)
Timestamp: Thu, 7 Mar 2013 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
I am using following code:
<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>
OP,
The issue that you're having is likely related to an error in your actual URL/resource. Unless we can replicate the error, we can't help you solve it. Providing code with a request to a URL which 503's won't get us anywhere, and is confusing.
Can you clone a piece of your private resource and insert dummy data where the sensitive information is?
Alternatively, can you copy and paste what you find if you look at your resource on
Line: 1 Char: 22
? Maybe a few lines before and after to be safe.