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

  • SEARCH
  • Home
  • 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 8448295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:23:17+00:00 2026-06-10T10:23:17+00:00

I have send data from my HTML page to servlet , this is the

  • 0

I have send data from my HTML page to servlet , this is the code

 <form name="search" id="search_bar" action="PathServlet" method="get">
        <table border="5" cellspacing="5" cellpadding="0"><tr>
        <td>
            <input Style="width:300px;"  name="one" type="text"  value="Enter Your Search Here" onFocus="clearText(this)" onBlur="clearText(this)">  <br/>
            <input Style="width:300px;"  name="two" type="text"  value="Enter Your Search Here" onFocus="clearText(this)" onBlur="clearText(this)">  <br/>


            <input type="submit" value="search"/></td></tr>
        </table>    
    </form>

In the servlet I create a list of XML

        response.setContentType("text/xml;charset=UTF-8");
    PrintWriter out = response.getWriter();
    out.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    out.append("<response>");
    try {
        for (int j = 0; j < path.size(); j++) {

            List<Pipes> tempDeal = PipesDAO.getInstance().findPath(
                    path.get(j).name, path.get(j).name);
            for (int i = 0; i < tempDeal.size(); i++) {
                result += "<deal>" + "<name>" + tempDeal.get(i).getName()
                        + "</name>" + "<lat>" + tempDeal.get(i).getLat()
                        + "</lat>" + "<lon>" + tempDeal.get(i).getLon()
                        + "</lon>" + "<desc>" + tempDeal.get(i).getId()
                        + "</desc>" + "</deal>";
            }
        }
        out.append(result);
        out.append("</response>");
    } finally {
        out.close();
    }

So now I want to return the respond data to a custom HTML page with Ajax.

         $.ajax({

But I don’t understand how to retrieve the data in the Ajax.

any idea??

  • 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. Editorial Team
    Editorial Team
    2026-06-10T10:23:19+00:00Added an answer on June 10, 2026 at 10:23 am

    Use jQuery to post the data using ajax. Check this link for step-by-step instructions:
    http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/

    Sample code snippet

    $(document).ready(function() {
        $('#form').submit(function() {
            var searchtext = $('#search').val();
            $.ajax({
                type:       "post",
                url:        "/PathToServlet",
                data:       "q=" + searchtext ,
                success:    function(data) {
                  alert('Data Recieved : ' + data);
                }
            });
    
        return false;
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I send data in this way: <form method=post enctype=text/plain action=Func> And I have a
Currently I'm able to send some form data from an HTML page to a
Usually when I get POST data it's send from a HTML form and the
Ultimately I have to send form post data from an iPad app to a
I have simple html page and need to post data (title/text) from that page
In HTML, you can send data from one page to another using a GET
I have a form that looks like this: <form action=/assesment/savelist/ method=post> <input type=hidden name=owner
I'm tying to send POST data from one site to another (both sites have
I'm trying to send data to the Controller from the View. I have a
I have this file 'gardens.php' , which pulls data from a table called 'generalinfo'

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.