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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:31:03+00:00 2026-05-24T10:31:03+00:00

A friend recently introduced me to jquery and now I’d like to use it

  • 0

A friend recently introduced me to jquery and now I’d like to use it rewrite and develop a inventory web application.

My original app consisted of a simple web page that required you to enter an id number and click a button. The id number is passed to a php file via the post method. The php file queries a database and displays the results in a table.

I created a HTML form that I would like to use update, enter new records, and display query results based on the button pressed.

At this time I want to display query results.

I have figured out how to use jquery to display the results of a query in a div at the bottom of my form. what I need help with is how if display the results in given location of the form.

Here is a real simple example of what I want:

HTML

<html>  
< head>  
< title>JQuery test< /title>  
< /head>  
< body>  
< form>  
< table>  
< tr>< th>Equipment ID< /th>  
< td>< input type="text name="eqid" id="eqid" />< /td>  
< th>Manufacturer< /th>  
< td>< input type="text name="manuf" id="manuf" />< /td>  
< th>Model< /th>  
< td>< input type="text name="model" id="model" />< /td>< tr>  
< /table>  
< div id=output> < /div>  
< /form>  
< /body>  
< /html>  

JQUERY

$("#submit_btn").click(function()  
{  
  var data = $('form:first').serialize();  
   $.ajax(  
   {  
    url:"passdata.php",   
    type: "POST",  
    data:data,  
    success:function(data)  
    {  
       $("#output").html(data);  
    } //end success  
   }); // end ajax  
});  // end click  

This what I’m using on my php file

PHP

<?php
    $eqid = $_POST['eqid'];  
    $manuf = 'Apple';  
    $model ='IPAD 2';  

    echo "<table border=0><tr>";
    echo "<th align ='left'>Manufacturer</th><td><input name='manuf' id='manuf' type='text' size='10' value=" . $manuf . "></td></tr>";  
    echo "<tr><th align ='left'>Surveyed by</th><td><input name='model' id='model' type='text' value=". $model . "></td></tr></total>";  
?php>

I would like the results of the query (manufacture and model) to be displayed in the appropriate location of the form in the example above.

Any suggestion would be greatly appreciated.

Chris

  • 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-05-24T10:31:04+00:00Added an answer on May 24, 2026 at 10:31 am

    passdata.php needs to do your database querying then return the data. JSON is a nice way of doing this.

    <?php
    $iteminfo = array('id' => $id, 'manuf' => $manuf, 'model' => $model);
    
    echo json_encode($iteminfo);
    ?>
    

    your ajax call then needs to take this data and populate your form.

    $("#submit_btn").click(function()  
    {  
      var data = $('form:first').serialize();  
       $.ajax(  
       {  
        url:"passdata.php",   
        type: "POST", 
        dataType: 'json', 
        data:data, 
        success:function(data)  
        {  
           $("eqid").val(data.id); 
           $("manuf").val(data.manuf);
           $("model").val(data.model);      
        } //end success  
       }); // end ajax  
    });  // end click 
    

    Of course if you’re using the same form for all CRUD operations, your php is going to have to be just as sneaky as your javascript. You sure this is a good idea for you?

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

Sidebar

Related Questions

Recently I have been working with my friend on a web application in play
I recently made a small app for a friend and then made it a
My friend who recently left our organisation also left his ClearCase view undeleted. Now
I'm helping a friend learn Haskell and he recently created code like this, which
I recently submitted my app to Apple through iTunes Connect, and it is now
I recently received some advice on a question regarding an easy to use web-framework
I've recently been introduced to development for iOS by a friend and have begun
I have recently created a small VB application for a friend of mine, I
A friend recently had the occasion for a legal name change, which made me
I and a friend recently implemented link grabbing in my Clojure IRC bot. When

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.