i am trying to get the title if it contains the characters in an input box So first if the user types ABC, then get the titles that contains A,B or C
$("#subSiteTitle").keypress(function () {
var checkTextTypedIn = $('#subSiteTitle').val();
hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));
var scriptbase = hostweburl + "/_layouts/15/";
$.getScript(scriptbase + "SP.RequestExecutor.js", execCrossDomainRequest);
function execCrossDomainRequest() {
var executor = new SP.RequestExecutor(appweburl);
var queryUrl = appweburl + "/_api/SP.AppContextSite(@target)/web/webs?$select=Title,Url,WebTemplate&$filter=WebTemplate ne 'APP'&$where=Title.Contains=checkTextTypedIn&@target='" + hostweburl + "'";
executor.executeAsync(
{
url: queryUrl,
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: successHandler,
error: errorHandler
}
);
}
});
This is my input box var checkTextTypedIn = $('#subSiteTitle').val();
Here is am trying to se if title contains $where=Title.Contains=checkTextTypedIn its not working right now because i dont now how to write the where statement? Can someone maybe help me ?

0 commentaires:
Enregistrer un commentaire