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

Java Server autocomplete json response

2 Answers 186 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Frik
Top achievements
Rank 1
Frik asked on 25 Jan 2012, 07:03 PM
Hi,

Can you please give me an example json response that a Java web server needs to send for this autocomplete code:

$(document).ready(function() {

var dataSource = new kendo.data.DataSource({
type: "jsonp",

transport: {

read: {

    url: "<c:url value="/Control?command=ko.sp_getCourses"/>"

}

}

});

$("#autoComplete").kendoAutoComplete({

  minLength: 3,

  dataTextField: "name", // JSON property name to use

  dataSource: dataSource

});

});


Thanks!

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 26 Jan 2012, 08:22 AM
Hello,

 JSONP is required only when the request violates the same origin policy. In your case it seems that JSON will work. Here is a sample response if you configure your DataSource to use json instead of jsonp:

[   {    name: "item1"   }, {    name: "item2"   } ]
 
This is an array of objects that have a "name" field.

Greetings,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ben
Top achievements
Rank 1
answered on 05 Apr 2012, 01:03 AM
Please see other thread.
Tags
AutoComplete
Asked by
Frik
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Ben
Top achievements
Rank 1
Share this question
or