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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:59:29+00:00 2026-06-17T13:59:29+00:00

Not sure what I’m missing, the value won’t post. I would like the code

  • 0

Not sure what I’m missing, the value won’t post. I would like the code to post to the current page (test.php)

<script>
$(document).ready(function(){
    $("#submit_response").click(function() {
         $.post(test.php, {name: 'demo'}, success: function(data) {

         });
     });    
});
</script>


<a href="#" id="submit_response" data-role="button" data-theme="a">Demo Save</a>

<?php if(isset($_POST['name'])) echo 'Posted: '.$_POST['name'];?>
  • 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-17T13:59:30+00:00Added an answer on June 17, 2026 at 1:59 pm

    Note that your content would’nt be updated with <?php if(isset($_POST['name'])) echo 'Posted: '.$_POST['name'];?>

    To make it work you can do like this :

    1st create a function called update() or everything you want in bottom of all your html after any content

    UPDATE FUNCTION :

    <?php
    function update(){
        if(isset($_POST['name']) && $_POST['name'] == "demo" ) {
            header('Content-Type: application/json');
            echo json_encode($_POST['name'])    ;
            exit(); // To avoid full html page be delivered
        }
    }
    ?>
    

    AND CALL IT BEFORE ALL YOUR HTML OR ANY CONTENT
    <?php update(); ?>

    Then your javascript to update your page :

    <script>
    $(document).ready(function(){
    $("#submit_response").click(function() {
            $.post(<?php echo '"'.$_SERVER['SCRIPT_FILENAME'].'"' ?>, {name: 'demo'}, dataType:"json", 
                success: function(data) {
                        $("#contentToUpdate").html(data.name);
                });
        }); 
    });
    
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not sure if this is even possible but I would like to add a
not sure what I'm missing here, but i keep getting the error. SQLSTATE[HY093]: Invalid
Not sure if this is a security feature, an oversight, or me missing the
Not sure If I am missing something here but appears that when I use
Not sure why i can figure this out but would appreciate some assistance. I
Not sure what is the problem as the script worked on previous pages fetching
not sure if this is possible keeping the code simple, but im trying to
Not sure if this is possible in Python, but I'd like to have an
Not sure what to call this, Option would fit just as well as Either,
Not sure why the images won't center: http://jsfiddle.net/xtian/BEXDG/ <div class=topic-tracker-info> <div class=container> <ul> <li>

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.