You can use jquery's post or get method to achieve this ($.post(url, params, callback) $.get(url, params, callback) )
Return value: XMLHttpRequest
Parameters:
•url (String): URL address of the loading page.
•params (Map): (Optional) Key/value pair parameters sent to the server.
•callback (Function): (optional) Function executed when the remote page is loaded.
When we submit a form, we usually require a pop-up of success/failure after the submission operation is completed. prompt box. At this time, the callback function is used.
Example:
Page submission form
function onSubmita()
{
var args = {
"resolution.cif":$("input[name='resolution.cif']") .val(),
"resolution.fourCif":$("input[name='resolution.fourCif']").val(),
"resolution.HeightP":$("input[name= 'resolution.HeightP']").val(),
"resolution.widthP":$("input[name='resolution.widthP']").val(),
"resolution.vga" :$("input[name='resolution.vga']").val()
};
if (confirm("Are you sure you want to submit the changes to the code stream settings?")) {
$.post("<%=basePath%>old/ResolutionAction-resolution.action?type=set",args, function(data) {
alert(data);
});
}
}
The server
executes the action and returns the return value
//. . . . . action method
getResponse().setContentType("text/html;charset=UTF-8");
getResponse().getWriter().print("Execution successful!");
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn