Hi there,
I am getting really crazy ... i tried everything for several days now and i am lost ... i am a newbie ... i know ... but please help me.
I wrote a simple HTML file. I connect to a very simple JSON service on a remote server. If i try with the URL "http://ip.jsontest.com" it works fine but with my own MCF service that also give correct JSON response (i tested it in JSONlint and you can try it your self on "http://extranet.atseven.nl/Freelance365_WS/Contracts.svc/getall") i just get the spinner of the igGrid component. The response of my JSON service is
{"BirthYear":1970,"FirstName":"Mark","LastName":"Bakker"}
The HTML code i use is:
<!doctype html>
<html>
<head>
<!-- Infragistics Combined CSS -->
<link href="Infragistics/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" />
<link href="Infragistics/css/structure/infragistics.css" rel="stylesheet" />
<!-- jQuery Core -->
<script src="Scripts/jquery-1.7.1.min.js"></script>
<!-- jQuery UI -->
<script src="js/jquery-ui.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.8.20.min.js"></script>
<!-- jQuery Templates: http://api.jquery.com/category/plugins/templates/ -->
<script src="Scripts/jquery.tmpl.min.js"></script>
<!-- Infragistics Combined Scripts -->
<script src="Infragistics/js/infragistics.core.js"></script>
<script src="Infragistics/js/infragistics.dv.js"></script>
<script src="Infragistics/js/infragistics.loader.js"></script>
<script src="Infragistics/js/infragistics.lob.js"></script>
<script type="text/javascript">
var data_url = "http://extranet.atseven.nl/Freelance365_WS/Contracts.svc/getall";
var jsonp = new $.ig.JSONPDataSource({ dataSource: data_url });
$(function () {
$("#grid").igGrid({
width: "1000px",
dataSource: jsonp,
autoGenerateColumns: true,
});
</script>
</head>
<body>
<div id="grid"></div>
</body>
</html>
Are you sure it is returning a valid JsonP response? Or is returning straight json?
JsonP would be needed for cross domain request.
A jsonp response would be wrapped callback( {"mydata" : "not here"});
Hi mhead1,
I think it is a correct JSON response. When i use the URL http://ip.jsontest.com it is working correctly and this response is also not wrapped. The response from this URL looks like
{"ip": "94.212.234.218"} when i use the URL in a browser.
My own made MCF service response is almost the same when i look at the structure.
The URL is: http://extranet.atseven.nl/Freelance365_WS/Contracts.svc/getall
The response is: {"IP":"192.168.0.1"}
The code for the MCF service is:
<OperationContract> _
<WebGet(BodyStyle:=WebMessageBodyStyle.Bare, ResponseFormat:=WebMessageFormat.Json)> _
Function GetAll() As IPadres
The code for the class and the function is:
Function GetAll() As IPadres Implements IContracts.GetAll
Dim myIP As IPadres = New IPadres
With myIP
.IP = "192.168.0.1"
End With
Return myIP
End Function
End Class
Public Class IPadres
<DataMember> _
Public Property IP() As String
Get
Return m_IPadres
End Get
Set(value As String)
m_IPadres = value
End Set
End Property
Private m_IPadres As String
Hello Mark,
Make sure that your JSON service works with jQuery $.ajax function. $.ig.DataSource (and its descendants) is using $.ajax function for the AJAX requests. If you're able to make your endpoint work with $.ajax function, then it should work with $.ig.DataSource. I was no able to make your JSON service work with $.ajax (of course I tried with JSONP, because for me this is a CORS). Maybe I'm missing something.
Hope this helps,Martin PavlovInfragistics, Inc.
Thanks for the info ... i think a have a JSONP problem in my Microsoft .NET WCF service. It is a datatable i want to return and i am using JSON.NET to serialize it. It wraps the total response in a string with escapes and this is not correct. I shall look on Google/.NET forum to try to find a answer for this problem.
Greetings,
Mark