Hi how to get json array elements in different ids in response?
//server side jsp
<%@page import="net.sf.json.JSONObject"%>
<%@page import="net.sf.json.JSONArray"%>
<%
JSONArray arrayObj=new JSONArray();
JSONObject obj=new JSONObject();
obj.put("name","data");// how can i display string "name" in secondcombobox id?
obj.put("roll_no","data"); how can i display string "roll_no" in thirdcombobox id?
out.println(obj.toString());
%>
client side jsp where retrieving json array elements in javascript
$("#firstcombo").change(function() {
$.get('comboboxpage.jsp', { combo1Val : $(this).val() }, function(responseData) {
$("#secondcomboboxid").replaceWith(data.name);// here i want to display name, how can i do it?
$("#thirdcomboboxid").replaceWith(data.roll_no);// here i want to display roll no, how can i do it?
});
});
<input type="text" id="secondcomboboxid" name="secondcomboboxid"/>// how can i show name here?
<input type="text" id="thirdcomboboxid" name="thirdcomboboxid"/> how can i show roll_no here?
How can i display name in secondcomboboxid and roll no in thirdcomboboxid? I googled a lot but could not find any solution, Any ideas please