The servlet is a Java programming language class used to extend the capabilities of a server.
Although servlets can respond to any types of requests, they are commonly used to extend the applications hosted by web servers,
so they can be thought of as Java applets that run on servers instead of in web browsers. These kinds of servlets are the Java counterpart to other dynamic Web content technologies such as PHP and ASP.NET.
you can call servlet from PHP.
following is code for that.
$(document).ready(function() {
$("#idd").click(function() {
var txt1 = $("#store").val();
$.ajax({
url : 'http://localhost:8080/xyz/AbcServlet',
data : 'val='+txt1,
type : 'GET',
success : function(response) {
alert("Success");
// create an empty div in your page with some id
},
error: function(){ alert("error");
}
});
});
});