JSP
<div id="feedback" class="statusbar"></div>
In jQuery
$("#categorySave").click(function(){
$getCode = document.getElementById("catCode").value;
$getName = document.getElementById("catName").value;
$getDesc = document.getElementById("catDesc").value;
$getDepID = $("select option:selected").val();
$(':text').val('');
$('#feedback').html('<img src="images/loading.gif"/>Processing....');
$.post("CategoryOperation", {
catCode:$getCode,
catName:$getName,
catDesc:$getDesc,
catID:$getDepID
}, function(html) {
$("#feedback").html(html);
});
});
In Servlet (CategoryOperation)
out.println("<div>Record Inserted!</div>");
When I press the save button (id=categorySave), it shows the message in div (id=feedback) as record inserted. The above code it working fine. But I want a little change now, that When record is inserted successfully, it shows result on text fields rather than on div (id=feedback).
Suppose,CategoryOperation (Servlet) print the followings two after process,
out.println("Record Inserted!");
out.println("1");
Now I want to show the above two output in the text fields respectively, and they have the following ID
id="Result"
id="Key"
How can I do this, in above jquery code snippet , by writing the following code or any other easy way
$('#Result').val();
$('#Key').val();