使用jquery将json字符串与下拉列表绑定 [英] Binding json string with drop-down using jquery
问题描述
// jsp
$ .ajax({
类型:GET,
url :WebPage,
数据:dataString,
dataType:json,
//如果收到服务器的回复
成功:函数(data,textStatus,jqXHR){
//我们的国家代码是正确的所以我们有一些信息要显示
if(data.success){
$('#ddl')。multiselect();
}
//显示错误信息
else {
}
},
});
// servlet
Gson gs = new Gson( );
String json = gs.toJson(names);
如何将我的字符串json变量绑定到jsp中的dropdownlist ?
//jsp
$.ajax({
type: "GET",
url: "WebPage",
data: dataString,
dataType: "json",
//if received a response from the server
success: function( data, textStatus, jqXHR) {
//our country code was correct so we have some information to display
if(data.success){
$('#ddl').multiselect();
}
//display error message
else {
}
},
});
//servlet
Gson gs = new Gson();
String json = gs.toJson(names);
How do I bind my string json variable to my dropdownlist in the jsp?
推荐答案
.ajax({
type:GET,
url:WebPage,
数据:dataString,
dataType:json,
//如果收到来自服务器
成功:函数(data,textStatus,jqXHR){
//我们的国家代码是正确的所以我们有一些信息要显示
if(data.success){
.ajax({
type: "GET",
url: "WebPage",
data: dataString,
dataType: "json",
//if received a response from the server
success: function( data, textStatus, jqXHR) {
//our country code was correct so we have some information to display
if(data.success){
('#ddl')。multiselect();
}
//显示错误信息
else {
}
},
});
// servlet
Gson gs = new Gson();
String json = gs.toJson(names);
如何将我的字符串json变量绑定到jsp中的下拉列表?
('#ddl').multiselect();
}
//display error message
else {
}
},
});
//servlet
Gson gs = new Gson();
String json = gs.toJson(names);
How do I bind my string json variable to my dropdownlist in the jsp?
这篇关于使用jquery将json字符串与下拉列表绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!