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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:41:07+00:00 2026-05-18T08:41:07+00:00

I have a function which sends specified form data to a php processing page.

  • 0

I have a function which sends specified form data to a php processing page.

function get(){

                $.post('data.php',{"name":$('#Fname').val(),"age":$('#age').val()},

                    function(output){
                $('#Rage').hide().html(output).fadeIn(1000);
                });
            }

After posting the script takes all the outputs from the php page (ie: echo’s) and puts them all the in #Rage div. $('#Rage').hide().html(output).fadeIn(1000);

I am wondering is it possible to have two different outputs for each of the inputs.

By this i mean an echo response for "name":$('#Fname').val() goes to #Rname and an echo response for "age":$('#age').val() goes to #Rage.

I hope i have explained myself well enough.

Cheers guys.

  • 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-18T08:41:08+00:00Added an answer on May 18, 2026 at 8:41 am

    You could have your PHP script return some JSON with those keys, and in the callback function, assign the values to their respective elements.

    Say you had the PHP script return this:

    header('Content-type: application/json');
    
    $return_obj = array('age' => 'someAge', 'name' => 'someName', 'success' => true);
    
    echo json_encode($return_obj); //{"age": "someAge", "name": "someName", "success":true}
    

    You could do this on the client side:

    $.ajax({
            url:'data.php',
            type:'POST', 
            data: {"name":$('#Fname').val(),"age":$('#age').val()},
            dataType: 'json',
            success:function(json) {
               if(json.success) {
                  $('#age').val(json.age || '');
                  $('#Fname').val(json.name || '');
               }
            }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following Ajax call which send form data to a page and
I have an update panel in my page which runs a function and sends
I have an function which decodes the encoded base64 data in binary data but
I have a simple PHP script that sends a message to a specified email
I have a login.jsp page which contains a login form. Once logged in the
I have a function which uses MSXML to post an XML document which yesterday
I have a function from django-registration which re-sends an activation email to the given
I have a function which parses one string into two strings. In C# I
I have a function which searches an STL container then returns the iterator when
I have a function which gets a key from the user and generates a

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.