At times we come across a requirement where we have to call a servlet in our js file. This can be achieved as shown below::
var value;
$.get('/bin/testservlet', function(data) {console.log('test',data);
value=data});
/bin/testservlet= This is the path property set in the servlet. The request looks for the servlet that has this path property set.
data=contains the response sent back from the servlet. The response returned can then be used for the needed logic.
In this example the get method is executed.
var value;
$.get('/bin/testservlet', function(data) {console.log('test',data);
value=data});
/bin/testservlet= This is the path property set in the servlet. The request looks for the servlet that has this path property set.
data=contains the response sent back from the servlet. The response returned can then be used for the needed logic.
In this example the get method is executed.
No comments:
Post a Comment