Expected '}' error - jQuery UI Autocomplete
Hi,
I am trying to use the auto complete option in jQuery UI for SharePoint OnPremise. I have tried the below code:
- $("input[title='Skill Required Field']").autocomplete({
source: function (request, response) {
var term = request.term;
var listname = "MySkills";
var resurl = siteURL + "/_api/web/lists/getbytitle('" + listname + "')/items?$select=Title&$filter=startswith(Title,'" + term + "')";
var alldata = [];
$.ajax({
url: resurl,
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
var items = data.d.results;
if(items.length > 0){
alldata.push(items);
}
response(alldata);
},
error: function (data) {
console.log(data.responseText);
}
});
}
- });
- I am getting the error as - Syntax error. Expected '}' . I am not sure, which of the parenthesis is missing.
- How to fix this?
- Thanks