title: Sending a value from JavaScript to JSP (with jQuery)
body: <p>Right now I have a JSP page that allows to sort some items, when is ready and a link is clicked a JavaScript function converts all the info into XML (text in a variable), after this i need to send this XML to the JSP page again, i tried putting the info in a hidden input and submitting the form, sending with $.post and a few more jQuery functions but nothing worked.
  Any ideas?</p>
  
  <p>In my JSP I'm reading the post like this:</p>
  
  <pre><code>&lt;% out.println(request.getParameter("data")); %&gt;
  </code></pre>
  
  <p>This doesn't work:</p>
  
  <pre><code>xml = "&lt;xml&gt;&lt;/xml&gt;";
  $("#form").submit(function(){
     alert("JS: " + $("#data").text());
     $("#data").text(xml);
  });
  </code></pre>
  
  <p>This either:</p>
  
  <pre><code>xml = "&lt;xml&gt;&lt;/xml&gt;";
  $("#data").text(xml);
  $("#form").submit();
  </code></pre>
  
  <p>And replacing .text with .html doesn't work too.
  Any ideas are welcome, thx</p>