I am trying to decipher the bing api results with datasource but not having success.
My datasource definiton:
var dataSource = new kendo.data.DataSource({
transport: {
read: {
type: "GET",
contentType: "applicatino/json; charset=utf-8",
url: "http://api.bing.net/json.aspx",
dataType: "jsonp",
data: {
AppId: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
Query: function() { var search = $("#bingSuggest").val(); return search; },
Sources: "web",
JsonType: "raw",
}//data
}//read
}, //transport
schema: {
data: "SearchResponse"
},
change: function() {
alert(this.view());
}
});
When the JsonType is used as "raw" as soon as the Bing returns results, a javascript error is displayed that the returned response has some syntax error. The reason I believe is - kendo (or jQuery?) tries to send the request with a callback=jquery211212... parameter. But Bing does not recognize this and needs different callback parameter.
2- I tried passing the json callback.
JsonType: "callback",
JsonCallback: "onBingSearch"
Now, bing returns results and no javascript error logged in console - but the callback is not called.
Trying to figure out 1) either how to use the 'raw' data or 2) how to get this callback called with the response?
Thanks,
Piyush
My datasource definiton:
var dataSource = new kendo.data.DataSource({
transport: {
read: {
type: "GET",
contentType: "applicatino/json; charset=utf-8",
url: "http://api.bing.net/json.aspx",
dataType: "jsonp",
data: {
AppId: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
Query: function() { var search = $("#bingSuggest").val(); return search; },
Sources: "web",
JsonType: "raw",
}//data
}//read
}, //transport
schema: {
data: "SearchResponse"
},
change: function() {
alert(this.view());
}
});
2- I tried passing the json callback.
JsonType: "callback",
JsonCallback: "onBingSearch"
Trying to figure out 1) either how to use the 'raw' data or 2) how to get this callback called with the response?
Thanks,
Piyush