I am new to JQuery. I have a servlet which will fetch data from the database and the result is kept is request and the same result is retrieved in jsp file. Now i have to call the servlet using ajax jquery to load the data. I am doing as below. But it is not loading. Please help me.
$('#myForm #revert').click(function() {
$.ajax({
type: "GET",
url: "./myController",
success: function(msg) {
<span style="color:green;font-weight:bold">Successful</span>');
},
error: function(ob,errStr) {
//Todo
}
});
});
Servlet code:
//Service call gets data and the result is kept in request scope as below
request.setAttribute("myresult", result);
request.getRequestDispatcher("/WEB-INF/myScreen.jsp").forward(request, response);
Thanks!