html Code
<div class="row">
<div class="col-sm-6">
<select class="form-control m-b" name="server_lists" id="server_lists">
<option></option>
{% for server_i in server_lists %}
<option value="{{ server_i.id }}">{{ server_i.public_ip }}</option>
{% endfor %}
</select>
</div>
<div class="col-sm-6 pull-right">
<select class="form-control m-b" name="server_lists" id="server_lists">
<option></option>
{% for server_i in server_lists %}
<option value="{{ server_i.id }}">{{ server_i.public_ip }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<button type="button" class="btn btn-default" id="select-all"></button>
<button type="button" class="btn btn-default" id="deselect-all"></button>
<select id="pre-selected-options" multiple="multiple" name="game_id">
</select>
</div>
</div>
<br>
<div class="row">
<div class="col-sm-4">
<button class="btn btn-primary" type="button" onclick="mtSelect(this)">
</button>
</div>
js Code
<script type="text/javascript">
$(document).ready(function () {
$("-sharppre-selected-options").multiSelect();
$("-sharpselect-all").click(function(){
$("-sharppre-selected-options").multiSelect("select_all");
return false;
});
$("-sharpdeselect-all").click(function(){
$("-sharppre-selected-options").multiSelect("deselect_all");
return false;
});
$("-sharpserver_lists").change(function () {
var server_i = $("-sharpserver_lists").val();
$.ajax({
data: {"obj_id": server_i, csrfmiddlewaretoken: "{{ csrf_token }}"},
type: "POST",
url: "/pro1/gamemigratedata/" + server_i + "/",
success: function (data) {
var content = "";
$.each(data, function (i, item) {
content += "<option value="+"""+item.gameid+"""+">"+item.gameid+"</option>"
});
alert(content);
$("-sharppre-selected-options").html(content)
}
})
});
});
</script>
questions are as follows:
jsalert(content);
$("-sharppre-selected-options").html(content)
so how do you change the situation now?