title: How to forward the data to another JSP page upon submit data to a link in a JSP page using AJAX?
body: <p>I have a URL link in the JSP form page. Once submit the form, all the data will submitted and call to the URL link. How can I forward those data that i submit to the URL link to another JSP page. </p>
  
  <p>index.jsp</p>
  
  <pre><code>&lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
      &lt;title&gt;JSP Page&lt;/title&gt;
      &lt;script type="text/javascript" src="js/jquery-1.11.3.min.js"&gt;&lt;/script&gt;   
      &lt;script type="text/javascript"&gt;
          function response() {
              $.ajax({
                  url         : "http://xxxxx/sendmsg",
                  data        : {
                      "username" : msg_user,
                      "recipient" : msg_recipient,
                      "sender" : msg_sender,
                      "content" : msg_content
                  },
                  success : function(data) {
                      $('#ajaxgetUserServletResponse').text(responseText);
                  },
                  error: function(data, err) {
                          console.error(err);
                  }
              });
          }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form action="http://xxxxx/sendmsg" method="post" target="_blank"&gt;
          &lt;input name=" msg_user" type="text"/&gt;&lt;br&gt;
          &lt;input name="msg_recipient" type="text"/&gt;&lt;br&gt;
          &lt;input name="msg_sender" type="text"/&gt;&lt;br&gt;
          &lt;input name="msg_content" type="text"/&gt;&lt;br&gt;
          &lt;button type="submit" style="display: none;"&gt;SUBMIT&lt;/button&gt;
      &lt;/form&gt;
      &lt;br/&gt;
      &lt;hr/&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>I'm able to submit the form and call to URL link. But unfortunately, there's only show successful response for the message without those detail of form we have submit previously. </p>
  
  <p><a href="https://i.stack.imgur.com/PmcSg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PmcSg.jpg" alt="Output Get "></a></p>
  
  <p>Below showing what's the ideal output I wish to get. 
  <a href="https://i.stack.imgur.com/IwgC6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IwgC6.jpg" alt="Ideal Output"></a></p>
  
  <p>Is there anyone who able to give my guide on how should I proceed or continue with it? </p>