I am trying to make an Ajax Call through a servlet, My request reaches servlet, but the response is not handled by the Ext Js.
Not sure if issue is on server side or ExtJs,
Following below is the code of the same:
ExtJs:
var button = Ext.create('Ext.Button', {
text: 'Reach Servlet!!!',
handler: function() {
Ext.Ajax.request({
url : 'ExportCsvServlet',
method:'POST',
scope : this,
//method to call when the request is successful
success : this.onLoginSuccess,
//method to call when the request is a failure
failure : this.onLoginFailure
});
}
});
onLoginSuccess : function(response,opts){
debugger;
alert('we got outout from servlet in success!!!!!');
},
onLoginFailure : function(err){
alert('we got outout from servlet in fault !!!!!');
}
---------------------------------Server Side------------------------------------------------------------
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("We are in servlet at last !!!!! ");
response.setContentType("text/html");
response.getWriter().print("{success: true, errorMessage: 'Error'}");
}