Ajax implements page Jump and result return, and ajax implements page Jump

Source: Internet
Author: User

Ajax implements page Jump and result return, and ajax implements page Jump
Partial page Jump and result return through ajax; 1. submission process with returned results

Here we use a submit button to demonstrate the HTML code:

<Input type = "button" class = "btn" value = "" name = "submit4" onClick = "tibao ();">

Click the submit button and use ajax to jump to the action for processing. The JavaScript code is:

function tibao(){
var id='';
var URL = <select:link page="/smokeplan.do?method=Tibao&idset="/>+id; $.ajax({url: URL,   type: 'GET',   success: function(result) { alert(result); } });
}

After the action is processed, the returned result is put into the result, and a prompt message is displayed on the page. Of course, xml must be configured for the action jump here.

The background Java class processing process is as follows:

// Report public void Tibao (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {String idset = request. getParameter ("idset"); CallHelper helper = initializeCallHelper ("L_SmokeBoxtibaoWLDan", form, request, false); helper. setParam ("bill_ids", idset); helper. setParam ("personid", getPersonId (request); helper.exe cute (); PrintWriter write = response. getWriter (); write. print (helper. getOutput ("message"); write. close ();}

Here we use an SQL statement to process the data, return a message, and print the information to the page;

The result of the operation here is to reflect the corresponding location of the response, so we get the stream that belongs to the response, instead of the new one.

That is to say, if I jump from there, I will return this information. Therefore, you can use the result in js to receive the returned result and use the alert prompt.

 

 

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.