I have a autocomplete search box when typing in my box I want to display the title of the subsite and also url
Here is my search box
<div id="searchfield"> <input type="text" name="currency" class="biginput" id="autocomplete"/> </div> Here is my code I app.js right now nothing gets displayed, event if I have an subsite named SubSite1
'use strict'; var hostweburl; var appweburl; // This code runs when the DOM is ready and creates a context object which is // needed to use the SharePoint object model $(document).ready(function () { //Get the URI decoded URLs. hostweburl = decodeURIComponent( getQueryStringParameter("SPHostUrl")); appweburl = decodeURIComponent( getQueryStringParameter("SPAppWebUrl")); // Resources are in URLs in the form: // web_url/_layouts/15/resource var scriptbase = hostweburl + "/_layouts/15/"; // Load the js file and continue to load the page with information about the list top level folders. // SP.RequestExecutor.js to make cross-domain requests // Load the js files and continue to the successHandler $.getScript(scriptbase + "SP.RequestExecutor.js", execCrossDomainRequest); }); function execCrossDomainRequest() { // executor: The RequestExecutor object // Initialize the RequestExecutor with the app web URL. var executor = new SP.RequestExecutor(appweburl); // Issue the call against the app web. // To get the title using REST we can hit the endpoint: // The response formats the data in the JSON format. // The functions successHandler and errorHandler attend the // sucess and error events respectively. executor.executeAsync( { url: appweburl + "/_api/SP.AppContextSite(@target)/web/webs?@target='" + hostweburl + "'", method: "POST", headers: { "Accept": "application/json; odata=verbose" }, success: function (data) { var subsite= JSON.stringify(data); $('#autocomplete').autocomplete({ lookup: subsite, }) } } ); } // This function prepares, loads, and then executes a SharePoint query to get // the current users information //Utilities // Retrieve a query string value. // For production purposes you may want to use // a library to handle the query string. function getQueryStringParameter(paramToRetrieve) { var params = document.URL.split("?")[1].split("&"); for (var i = 0; i < params.length; i = i + 1) { var singleParam = params[i].split("="); if (singleParam[0] == paramToRetrieve) return singleParam[1]; } }