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 8746851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:15:37+00:00 2026-06-13T12:15:37+00:00

I was using a self submitting form to process the data but I now

  • 0

I was using a self submitting form to process the data but I now need to process it separately so now I need to submit a form, return the results and place it in a div. It seems using AJAX is a good way to do this to have the data return to the original page where the form is. I have had a look at alot of examples and I don’t really understand how to do it or really how its working.

Say I wanted to send this form data from index.php to my process page twitterprocess.php what do I need to do and get it to return to display the data processed.

<form method="POST" action="twitterprocess.php">
    Hashtag:<input type="text" name="hashtag" /><br />
    <input type="submit" value="Submit hashtag!" />
</form>

This is what I have been using to display the results.

<?php foreach($results as $result) { 
    $tweet_time = strtotime($result->created_at);?>
    <div>
    <div class="tweet"> <?php echo displayTweet($result->text),"\r\n"; ?>
    <div class="user"><?php echo "<strong>Posted </strong>" . date('j/n/y H:i:s ',$tweet_time) ?><strong> By </strong><a rel="nofollow" href="http://twitter.com/<?php echo $result->from_user ?>"><?php echo $result->from_user ?></a></div>
    </div>
    <br />
<? } ?>

I’m new to AJAX but any guidance would be greatly appreciated

  • 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-13T12:15:38+00:00Added an answer on June 13, 2026 at 12:15 pm

    *When you use AJAX the output generated on other page is the result for this page.

    *Now when you want to post data and retrieve results through the use of AJAX then in form part of your html don’t use type=”submit” for button, but simply go for type=”button”.

    *action attribute should be left blank as you are going to trigger the action through your AJAX code.

    *Well rest all your solution in the code snippet below:

    Below is the HTML code along with AJAX

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Simple Form Handling Through AJAX</title>
    <script type="text/javascript">
        function loadXmlDoc(fname, lname){
            var xmlhttp;
            if (window.XMLHttpRequest){
                xmlhttp = new XMLHttpRequest();
            }
            else{
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange = function(){
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
                    document.getElementById("ajaxify").innerHTML =                xmlhttp.responseText;
                }
            }
            xmlhttp.open("POST", "demo_ajax3.php", true);
            xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            xmlhttp.send("fname=" + fname + "&" + "lname=" + lname);
        }
    </script>
    </head>
    
     <body>
    <p>
        <span id="ajaxify">&nbsp;</span>
    </p>
    <form  id="frm" action="#">
        <input type="text" name="fn" />
        <input type="text" name="ln" />
        <input type="button" name="submit" value="submit" onclick="loadXmlDoc(fn.value, ln.value)" />
    </form>
    </body>
    </html>
    

    Below is the PHP code that is used in above code

    <?php
    $fname = $_POST["fname"];
    $lname = $_POST["lname"];
    echo "Hello " . $fname . " " . $lname;
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to load my project using a self-made .asd file, but somehow
Using Cocos2d to draw a thicker circle: glLineWidth(20); ccDrawCircle(self.ripplePosition, _radius, 0, 50, NO); But
I am using [self.view addSubView:tabBarController.view]; But because of this viewDidAppear and viewWillAppear is not
My application is using Self-Tracking Entities & I get my data from a WCF
I am submitting a form via a jqery function that's dynamically created with using
I can see first-class member variables using self.__dict__ , but I'd like also to
I need help with what I thought would be a simple form submit problem
Using self.GetParent().FindWindowById(wx.ID_FORWARD).Disable() I am able to disable the next button altogether, but I only
I have pushed a view controller using [self.navigationController pushViewController:myVC animated:YES]; now I am inside
As of now, I've been using self-executing anonymous functions in order to avoid having

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.