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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:31:06+00:00 2026-05-30T07:31:06+00:00

I have an AJAX request that sends information off to a page with POST,

  • 0

I have an AJAX request that sends information off to a page with POST, and returns the following:

        echo '<tr>';
        echo '<td>';
            echo $product1;
        echo '</td>';

        echo '<td>';
            echo $code1;
        echo '</td>';

        echo '<td>';
            echo $value1;
        echo '</td>';

        echo '<td>';
            echo $time1;
        echo '</td>';


    echo '</tr>';
//  echo '</table>';

    echo 'Your code has been successfully redeemed!';

This is my code on the client-side:

        }else{

        $('#poo tr:last').after(result);

    }

My question is… although this works fine as this is appended on to the end of a table client side, I would also like to pass through another variable to be used in PHP, or more specifically, a database query result that can be used within PHP.

Cant seem to figure out how to output different stuff as it will mess up my current arrangement of just echoing out HTML.

Any ideas?

Thanks! 🙂

  • 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-30T07:31:07+00:00Added an answer on May 30, 2026 at 7:31 am

    You could use a json structure:

    echo json_encode( array( "html" => $myhtml, "otherdata" => $myotherdata ) );
    

    and then in jquery access each part.

    $.ajax({
      url: "myhandler.php",
      dataType: "json"
    }).done(function(json){
      $('#foo tr:last').after(json.html);
      alert(json.otherdata);
    });
    

    Note, however, if $myotherdata is an associative array (or object as we call it in javascript) the alert will simply show [object Object] ( which is not an error! reference it’s properties with dot syntax or array syntax json.otherdata.key or json.otherdata["key"] )

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

Sidebar

Related Questions

I have a web page that sends information via AJAX to a server. I
I have a tooltip on an anchor element, that sends an AJAX request on
I have a jQuery AJAX post request that is unexpectedly triggering the error callback
I have ajax request that do 3 missions: Save Model (DB) Send Email Give
I have an app that sends multiple Ajax requests simultaneously. I was originally running
I have an Ajax request that can return more than one valid value, so
I have a AJAX request that will return a string that contains some HTML
I have a Ajax request that fires on clicking a href that is part
I have several HTML elements (buttons) that fire the same JQuery AJAX request. When
In my application I have a drop-down form that fires up an AJAX request

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.