jsp - How to get a 'select-option' area updated automatically with the values from the database..? -
i want "select-option" option values updated automatically. mean is
want specific values in database put in select-option area whenever updated in database when user registered in database want his/her registration number updated in "option-select" area same time.how do it. coding in java/jsp/servlet.
i don't know if right point in question, key there use js-->java-->js
@requestmapping("/url/loaddata") @responsebody public string loaddata() throws exception { jsonserializer s = new jsonserializer(); return s.serialize(classservice.getdata()); //method find parsing of data db }
call mapping in js
function loaddbdata() { $.ajaxutility({ url : '/url/loaddata.htm', showerrorprompt : true, showinfoprompt : false, success : function(data, xhr, s) { datafromdb = data; $(datafromdb).each(function(index, value){ $("#mydropdownbox").empty(); $("#mydropdownbox").append(generateeachdata(value)); }); } }); } function generateeachdata(dataitems){ html = '<option>'+dataitems+'</option>'; return html; }
just call loaddbdata() upon event when want update or call data db. hope :)
Comments
Post a Comment