I am trying to display the value of #response from the code below into the input fields. Here is the code.
<script>
$(document).ready(function() {
$("#productID").change(function() {
//alert($('#productID option:selected').val());
var pId = $('#productID').val();
$.get('updateProduct', {
productID: pId.trim() //using trim to get rid of any extra invisible character from pId
},
function(responseText) {
$('#response').val(responseText);
});
});
});
</script>
$('#response').val(responseText); --> If this contains two values then is there a way to retrieve those values separately? what I would like to do is display values separately into three separate input fields.
$('#response').val(responseText);
This could contain values such as, Product Description, Product comments, Product type. Those values are coming from the servlet. After receiving those values they will be displayed into three separate input field.
At the moment if I do the following,
<input type="text" id="response"/>
This will display all three values in the same input field. Any idea how could I display three values in three separate input fields? Thanks in advance
input is coming from a servlet page. Inside the "doGet" i have the following code.
for (Product8339384 ps1 : ps) {
comments = ps1.getComments();
description =ps1.getDescription();
}
out.println(comments);
out.println(description);
Output: The output should be displayed inside the two separate input fields. which will display comments and description. both those values received from the DB.