Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 95025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:35:37+00:00 2026-05-10T23:35:37+00:00

Right now I have a JSP page that allows to sort some items, when

  • 0

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?

In my JSP I’m reading the post like this:

<% out.println(request.getParameter('data')); %> 

This doesn’t work:

xml = '<xml></xml>'; $('#form').submit(function(){    alert('JS: ' + $('#data').text());    $('#data').text(xml); }); 

This either:

xml = '<xml></xml>'; $('#data').text(xml); $('#form').submit(); 

And replacing .text with .html doesn’t work too. Any ideas are welcome, thx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T23:35:37+00:00Added an answer on May 10, 2026 at 11:35 pm

    You’re probably going the wrong way here. You didn’t provide the html code, but I assume it is something like this:

    <form method='POST' id='form'>     <input type='hidden' id='data' /> </form> 

    If that is correct, then you should say $('#data').val(xml); instead of text() or html() as those change the matched thing with text or html you provide. This should work for your current solution.

    Also I’d propose to look at jQuery’s $.post() and others as an alternative to packing everything as xml unless this is really what you want on the backend. It could be easier to just make up a javascript object with all the values keyed by some names and pass it on to one of jQuery’s $.post(), $.get(), etc. like this:

    var values = {name: 'John', surname: 'Doe'}; values.age = 25; $.post('index.jsp', values); // this will result in a post with 3 variables: name, surname, age 

    Actually it only occured to me now that you can also send your xml this way (unless you prefer your way of doing things):

    $.post('index.jsp', {data: '<xml><whatever-else-needs-to-be-in-here/></xml>'}); 

    You might want to enlighten yourself more here: Ajax @ jQuery docs

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I have an SSIS package that runs every morning and gives me
Right now I have a table called Campaigns that has many Hits, if I
I have a project that needs to be changed.. right now i have a
Right now I have a class A that inherits from class B , and
Greetings, here is the problem. I have a page called entList.jsp , that works
I have a jsp page having two text field id and name. Now I
I right now have a problem that is rather confusing to me: I have
Right now I have a script that creates symlinks to anything newer than 2
Right now I have a database (about 2-3 GB) in PostgreSQL, which serves as
Right now I have the following in my .vimrc : au BufWritePost *.c,*.cpp,*.h !ctags

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.