This is a migrated thread and some comments may be shown as answers.

Grid Binding with restful service

5 Answers 135 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
pratima
Top achievements
Rank 1
pratima asked on 23 Apr 2014, 04:17 AM
Currently my web application is in flex ui , We are trying to migrate to kendo ui. But im facing problem in binding the grid with restful services . 
I used ajax call and was able to bind it to IE of a lower version. But the code still doesnt work with other browsers and also IE of higher version.


5 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 23 Apr 2014, 07:50 AM
Hello,

We are not sure what the problem is. Could you please clarify? Providing some code, screenshots will help us understand the issue you are dealing with.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
pratima
Top achievements
Rank 1
answered on 23 Apr 2014, 10:00 AM
jQuery.support.cors = true;
                     $.ajax({
                         crossDomain: false,
                         type: "GET",
                         url: "---some url---",
                         dataType: "xml",
                         data:"xmlstring",
                         success: handleData,
                         error: function (xhr) {
                          xhr1=xhr;
                             alert(xhr);
                             
                             alert("error");
                         }
                         
                     }



                     );

                     function handleData(xml) {                  
                      
                         xmlData=xml.xml;
                         alert(xmlData);                  
                         $("#grid").kendoGrid({

my restful service returns an xml as output. after enabling cros i was able to get the response in IE8 . But it did not work for firefox . but now this code doesnt work for IE10 as well.

it gives me the following error.

SEC7120: Origin http://localhost:3080 not found in Access-Control-Allow-Origin header.
index1.html
SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.
0
Atanas Korchev
Telerik team
answered on 23 Apr 2014, 10:07 AM
Hello,

This is probably caused by the same origin policy and isn't related to Kendo UI. To enable cross domain ajax you would need either JSONP or to enable CORS for your service. 

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
pratima
Top achievements
Rank 1
answered on 23 Apr 2014, 12:17 PM
I have tried enabling the cross domain, But i failed.
So i moved on to using jsonp.
now it is not throwing me an json error.
But it is giving me a following error ,

SCRIPT1004: Expected ';'

the service returns a valid json which i validated in the online validator.

 $("#grid").kendoGrid({
                         dataSource: {
                             transport: {
                                 read: {
                                     url: "someurl", // the remove service url
                                     dataType: "jsonp"//, // JSONP (JSON with padding) is required for cross-domain AJAX
                                    
                                 }
                             },
                             schema: {
                                 data: "abc",
                                 model: {   
                                 fields: {
                                     xyz: { type: "string" }
                                   
                             },


0
Atanas Korchev
Telerik team
answered on 23 Apr 2014, 01:55 PM
Hello,

You should have in mind that JSONP is not the same as JSON. A JSONP response is slightly different. Double check that your service returns valid JSONP response.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
General Discussions
Asked by
pratima
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
pratima
Top achievements
Rank 1
Share this question
or