0
기본적으로 자동 완성 메서드에서 source
매개 변수에 대한 작업을 수행하는 함수로 이동하려고 시도했지만 이제 스크립트가 손상됩니다. $.get(...)
요청에 의해 값이 반환되는 경우에도 입력 할 때 옵션이 표시되지 않습니다.JQuery UI 소스 코드에서 함수로 자동 완성
html로 :
<tr class="itemTableRow">
<td>
<input type="text" class="item" name="items[]" />
</td>
<td>
<input type="range" class="quantity" min="1" max="10000" name="quantity[]" />
</td>
<td>
<select class="versionSelect"><option value="5">5</option><option value="6">6</option><option value="7">7</option></select>
</td>
</tr>
자바 스크립트 :
$(function() {
$(".item").autocomplete({
source: function(request, response){var data = $.get("http://mydomain.com/dev/kohana/utils/items/search?searchType=maxList&term=" + request.term + "&version=" + $(".item").parent().parent().children(":nth-child(3)").children("select").val()); console.log("" + data); response(data);},
minLength: 2
});
});
결과 HTTP GET (CP가 입력 필드에 입력) 요청 URL :
http://mydomain.com/dev/kohana/utils/items/search?searchType=maxList&term=CP&version=5
결과 HTTP 응답 본문 :
[{"label":"CP1031L","value":"CP1031L"},{"label":"CP1031M", "value":"CP1031M"]
Jquery UI의 기본 스타일 시트도 페이지에 포함 시켰지만 이전에는 작동 했었지만 나는 기능적인 콜백이 어떻게 작동해야하는지에 대해 아주 기본적인 것을 놓치고있는 것처럼 느껴진다. 아무도 문제를 발견 할 수 있습니까? 도와 주셔서 감사합니다.
그래, 나는 내 자신의 질문에 대답 만하고 있었다. 때로는 간단한 것들. 그래도 끝내 주셔서 감사합니다. 그러나 나는 어떤 이유로'.parseJSON' 데이터를 필요로했습니다. – thatidiotguy