使用jquery将json字符串与下拉列表绑定 [英] Binding json string with drop-down using jquery

查看:122
本文介绍了使用jquery将json字符串与下拉列表绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

// 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆