Hello experts,
I am trying to access external service url using javascript but it throws undefined as an alert instead of json response. Can some one pls tell me where is going WRONG in the below JS function. And i am able to access my data correctly in the browser as json response string format data. Please help for this webresource.... can some one please point me right path as i need to generate table with this json response runtime in html table format.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<!--<script src="jquery-1.7.1.js" type="text/javascript"></script>-->
<script type="text/javascript" src="../WebResources/eb_xrmjquery"></script>
<script type="text/javascript">
$(document).ready(function ()
{
});
var GetJson = function ()
{
var requestdata = {};
$.ajax({
type: "GET",
//data: JSON.stringify(),
url: "localhost/.../0000003049",
contentType: "application/json;charset=utf-8",
dataType: "json",
success: function ()
{
alert(data);
},
error: function (xhr)
{
alert(xhr.responseText);
}
});
}
</script>
</head>
<body>
<br />
<input type="button" id="jsonButton" onclick="GetJson()" value="Bind JSON" />
<br />
<br />
<div id="jsonData">
</div>
</body>
</html>