Reputation: 1859
When I tried to access the below URL:
I get a JSON service response. I'm trying to read this response via Jquery, like so :
(function()
{
var serviceAPI = "http://dhclinicappv2stg.item-soft.co.il/LinkCareAppService.svc/json/GetFinalReportToAccount?AccountId=?";
$.getJSON( serviceAPI,
{
AccountId: "123"
})
.done(function( data )
{
alert(data);
});
})();
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery.getJSON attempt</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
<div id="data"></div> <!-- in the future, I will add the data to this div -->
<script>
</script>
</body>
</html>
Yet I get a blank page, with no alerts. The console log reads the error in the title.
Upvotes: 0
Views: 356
Reputation: 7746
There is no issue with Service. Only mistake with your service URL remove ?AccountId=?
due to this service call triggered as like below.
/GetFinalReportToAccount?AccountId=jQuery21101485728188417852_1451208967751&AccountId=123&_=1451208967752
Try the below working snippet where parameter removed in URL for getJSON
Method.
(function() {
var serviceAPI = "http://dhclinicappv2stg.item-soft.co.il/LinkCareAppService.svc/json/GetFinalReportToAccount";
$.getJSON(serviceAPI, {
AccountId: "123"
})
.done(function(data) {
$('#data').text(JSON.stringify(data));
});
})();
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery.getJSON attempt</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
<div id="data"></div> <!-- in the future, I will add the data to this div -->
</body>
</html>
Upvotes: 2