내 ASMX 웹 서비스에 게시,이 오류가 반환됩니다아약스 후 반환 오류
유형 'myProjectName.AutoCompleteWebService'을 만들 수 없습니다.
나는 StackOverflow 및 다른 많은 사이트에서 모든 답변을 시도했지만 아무도 내 경우에는 작동하지 않습니다.
JQuery와
$("#txtSearchKeyWord").autocomplete({
source: function (request, response) {
$.ajax({
url: "AutoCompleteWebService.asmx/IndentifySearch",
data: "{ 'keyWord': '" + request.term + "','Lang': 'En' }",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
dataFilter: function (data) { return data; },
success: function (data) {
$(currentElement).css({ "background": "rgb(255, 255, 255) none repeat scroll 0% 0%/auto padding-box border-box" });
response($.map(data.d, function (item) {
return {
value: item
}
}))
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
},
open: function (event, ui) {
//$(".ui-autocomplete").css("left", (parseInt($(".ui-autocomplete").css("left").replace("px", "")) - 114).toString() + "px");
},
minLength: 3,
appendTo: "#Autocontainer"
});
ASMX
<%@ WebService Language="C#" CodeBehind="AutoCompleteWebService.asmx.cs" Class="RoyalTours.AutoCompleteWebService" %>
C#
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class autocomp : System.Web.Services.WebService
{
[WebMethod]
public List<string> IndentifySearch(string keyWord)
{
string currentPageURL = HttpContext.Current.Request.Url.AbsolutePath;
List<Package> olstPackage = null;
olstPackage = new PackageRepository().SearchPackage(keyWord);
List<string> olstResult = null;
if (olstPackage.Count > 0)
{
olstResult = new List<string>();
for (int indexCountry = 0; indexCountry < olstPackage.Count; indexCountry++)
{
olstResult.Add(olstPackage[indexCountry].KeyWord);
if (olstPackage.Count <= 0)
{
olstResult.RemoveAt(indexCountry);
}
}
}
return olstResult;
}
}
예 내가 피곤 너무 그래서 난 내 클래스 이름에 대한 관심을 지불하지 않았다 나는 잘 생각하고 있습니다 이 진정한 답변을 도와 주셔서 감사합니다 .... –
도와 줘서 기뻐! – Santi
고마워 ... :) –