SharePoint 2010 Questions.
I am trying to create an auto suggesting text-box with multiple values in a SharePoint web part. i am using j query and SharePoint list web services to do it. I am just learning to do these stuffs but not getting a result. Any help much appreciated.
Following is the code. i am creating an alert to see if i get any data but it alerts a blank dialog
this is my latest code
var restServiceAddress = "/_vti_bin/ListData.svc/";
var listName = "Topics";
function split(val) {
return val.split(/,\s*/);
}
function extractLast(term) {
return split(term).pop();
}
$(document).ready(function () {
$('#<%=input_title.ClientID%>').autocomplete({
source: function (request, response) {
$.ajax({
type: "POST",
contentType: "application/json;charset=utf-8",
url: "" + restServiceAddress + listName,
data: "{'Title':'" + request.term + "'}",
dataType: "json",
success: function (data) {
response($.map(data.d, function (item) {
return item.Title;
}))
}
});
},
focus: function () {
return false;
},
select: function (event, ui) {
var terms = split(this.value);
terms.pop();
terms.push(ui.item.value);
terms.push("");
this.value = terms.join(", ");
return false;
},
minlength: 1
});
});