I wanted to a autocomplete textbox just like the one in
http://www.flipkart.com/.So I am using autocomplete() function to do that.Source for the autocomplete() is a web service which fetches relevant data from DB.The code I am using for autocomplete is below:
$(document).ready(function () {
$('#<%=txtSerach.ClientID %>').autocomplete({
source: function (request, response) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "../AutoComp.asmx/GetSuggestions",
dataType: "json",
data: "{'typedText':'" + request.term + "'}",
success: function (data) {
response($.map(data.d, function (item) {
return { value: item }
}))
}
});
},
minLength: 2,
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
});
There is no problem in working.But when the user right clicks and view source the url of the service is visible to him and user can easily use my webservice in their website or any other purposes.But in the case of Flipkart.com we do not find any url of the service in autocomplete function.Can you please tell me how it can be done in my case.Is there any other solutions to do autocomplete?.