I am trying to display the value of #response from the code below into the input field. I am not sure how that can be done. If I use
<div id="response"></div>
that will display the result but I like to display it in the input field. I tried this,
<input type="text" id="response"/>.
This did not display the result Any idea how that could be done. Thanks in advance.
<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').text(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 two separate input field.
$('#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.