While doing some client script have faced the issue.
$.each(searchWords, function (key, word) {
if (key) filterWords += "%20and%20";
// double up any single quotes
word = word.replace(/'/g, "''");
// url escape word
word = encodeURIComponent(word);
filterWords += "contains(ProductName,'" + word + "')";
});
// create base portion of the URI
var queryUri = serviceUri + "Products?" +
"$select=ProductID,ProductName&" +
"$top=100&" +
"$filter=" + filterWords;
// configure datajs to allow cross domain callbacks using JSONP
OData.defaultHttpClient.enableJsonpCallback = true;
// run query
OData.read(queryUri, function (queryResponse) {
// for each result, add to list
$.each(queryResponse.value.results, function (o) {
$("#queryResultsList").append("
" + this.ProductName + "
");
No comments:
Post a Comment