AJAXis an abbreviation Asynchronous JavaScript And XML. It provides asynchronous communication with the server.
To explain this in simple terms, you can send a request to the server and continue interacting with the user. You do not need to wait for a response from the server. After the response is received, the designated area in the user interface will update itself and reflect the response information. Unable to reload the entire page.
, Java- url, Ajax. URL-, JSP, Servlets, PHP ..
JSP (, hello.jsp)
<%
String strResponse;
mail.Main objMain = new mail.Main();
strResponse = objMain.execute();
%>
<%=strResponse %>
Ajax
url: "hello.jsp",
EDIT: :
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
function getData() {
var dataToBeSent = {
uName : $("#userName").val() ,
passwd: $("#password").val()
};
$.ajax({
url : 'getDataServlet',
data :dataToBeSent,
type : 'POST',
dataType : 'html',
success : function(response) {
$('#outputDiv').html(response);
},
error : function(request, textStatus, errorThrown) {
alert(errorThrown);
}
});
}
});
Servlet/JSP request.getParameter("uName");