如何在选择框中选择多个值时调用Jquery Ajax。
此致 拉吉
答案 0 :(得分:2)
我使用这种方法,只有你可以在帖子中看到更多:
var mySelections = [];
$('#mySelect option').each(function(i) {
if (this.selected == true) {
mySelections.push(this.value);
}
});
$.ajax({
type: "post",
url: "http://myServer" ,
dataType: "text",
data: {
'service' : 'myService',
'program' : 'myProgram',
'selected' : mySelections
},
success: function(request) {
result.innerHTML = request ;
}
}); // End ajax method
答案 1 :(得分:-1)
public static boolean display(String titolo,String messaggio){
Dialog<Boolean> dialog = new Dialog<>();
dialog.setTitle(titolo);
dialog.getDialogPane().setContentText(messaggio);
dialog.getDialogPane().getButtonTypes().addAll(
ButtonType.YES, ButtonType.NO);
// Result of dialog is true if button is YES button,
// false otherwise
dialog.setResultConverter(button -> button == ButtonType.YES);
// return result of dialog, or false if there is no result
// (i.e. if user closes dialog without pressing a button)
return dialog.showAndWait().orElse(false);
}