여기 내 해결책이 있습니다. 아이디어는 일종의 트위터와 같은 페이지 매김을 구현하는 것이며, 처음부터 몇 가지 선택을 렌더링해야합니다.
<div data-role="page">
<div data-role="header">
<h1>Page Title</h1>
</div><!-- /header -->
<div data-role="content">
<p>Page content goes here.</p>
<div data-role="fieldcontain">
<label for="select-choice-1" class="select">Choose shipping method:</label>
<select name="select-choice-1" id="select-choice-1">
<option value="standard">Standard: 7 day</option>
<option value="rush">Rush: 3 days</option>
<option value="express">Express: next day</option>
<option value="overnight">Overnight</option>
<option value="-1">More...</option>
</select>
</div>
</div><!-- /content -->
<div data-role="footer">
<h4>Page Footer</h4>
</div><!-- /footer -->
</div><!-- /page -->
는 그 다음 더 많은 옵션
<script type="text/javascript">
$(document).bind("pageshow", function(){
bindMore();
});
function bindMore(){
// The rendered select menu will add "-menu" to the select id
$("#select-choice-1-menu li").last().click(function(e){handleMore(this, e)});
}
function handleMore(source, e){
e.stopPropagation();
var $this = $(source);
$this.unbind();
$this.find("a").text("Loading...");
// Get more results
$.ajax({
url: "test.js",
dataType: "script",
success: function(data){
$(eval(data)).each(function(){
// Add options to underlaying select
$("#select-choice-1 option").last()
.before($("<option></option>")
.attr("value", this.value)
.text(this.text));
});
// Refresh the selectmenu
$('#select-choice-1').selectmenu('refresh');
// Rebind the More button
bindMore();
}
});
}
</script>
Test.js 일부 핸들러 후크는이 포함
[
{"value": "1", "text": "1"},
{"value": "2", "text": "2"},
{"value": "3", "text": "3"}
]
이 좋은 시작이다. 방금 너 한테 현상금이있어. 감사! –
@Chris 고마워! 다행스럽게 도울 수있어! – jimmystormig