2017-03-03 1 views
-1

MVC 5, Entity Framework, APP를하고 있습니다.mvc autocomplete jquery json 목록이 표시되지 않습니다.

도시에는 자동 완성이 있지만 autocomplete의 응답은 목록에 표시되지 않습니다.

아마도 jquery.js가 누락되었습니다.

여기 enter image description here

내 컨트롤러는 다음과 같습니다 ... 내 HTML 코드입니다.

[HttpPost] 
 
     public JsonResult GetCityByCountryState_Id(int country_id=1, int state_id=2, string prefix="") 
 
     { 
 
      IEnumerable<Cities> cityName = _cityRepository.GetByCountryState_Id(country_id, state_id, prefix); 
 
      return Json(cityName.Select(m => new 
 
      { 
 
       id = m.city_id , 
 
       name = m.Description 
 
      }), JsonRequestBehavior.AllowGet); 
 

 
     }

나는 경고 OnSuccess을 넣고는 ID와 값을 반환합니다.

내가 뭘 잘못하고 있는지 알기! 내가 크롬에서 그쪽으로 페이지를 실행할 때

덕분에 여기

enter image description here

가의 .js의 목록은 내가

_Layout.cshtml 

에 포함했다, 그것은 다음과 같은 오류 OnSucess

을 보여줍니다 enter image description here

Jquery.js에 오류가 표시됩니다.

아이디어가 있으십니까?

+0

조치가 작동하는지 확인 했습니까? 일부 결과가 반환되는 것을 의미합니까? –

+0

예, 경고 (값) onsucess를 추가하고 결과를 보여줍니다. – Diego

+0

코드가 올바른 것처럼 보이지만 참조 용으로 http://www.c-sharpcorner.com/UploadFile/0c1bb2/creating-autocomplete-textbox-in-Asp-Net-mvc-5/ –

답변

-1

문제는 Jquery 오류 uncaught typeerror this.options.messages.results is not a function입니다. messages: 태그를 수정하여 해결되었습니다.