. , .
<div data-role="page">
<div data-role="header">
<h1>Page Title</h1>
</div>
<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>
<div data-role="footer">
<h4>Page Footer</h4>
</div>
</div>
""
<script type="text/javascript">
$(document).bind("pageshow", function(){
bindMore();
});
function bindMore(){
$("#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...");
$.ajax({
url: "test.js",
dataType: "script",
success: function(data){
$(eval(data)).each(function(){
$("#select-choice-1 option").last()
.before($("<option></option>")
.attr("value", this.value)
.text(this.text));
});
$('#select-choice-1').selectmenu('refresh');
bindMore();
}
});
}
</script>
Test.js :
[
{"value": "1", "text": "1"},
{"value": "2", "text": "2"},
{"value": "3", "text": "3"}
]