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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:20:05+00:00 2026-06-01T01:20:05+00:00

I am trying to submit a form with ajax. Here is my complete code

  • 0

I am trying to submit a form with ajax. Here is my complete code

<?php 
    $wparent = "123";
    $method = "sms";
?>

<script type="text/javascript">
    $(document).ready(function(){
        $("#post_<?php echo $wparent;?>").click(function(){
            $('#parentpost-<?php echo $wparent;?>').html('Loading.....');
            $("#parentpost-<?php echo $wparent;?>").load("<?php echo SITE_URL;?>new_ajax/post_reply.php", {message:$("[name=replynote]").val(), method:$("[name=method]").val(), parent:$("[name=parent]").val()}); //end
        }); // end of the main click function
    });
</script>

<?php   
echo "<textarea name='replynote' ></textarea>";
echo "<input type=\"submit\" class=\"post_button\" id=\"post_$wparent\" value=\"post\" />";
echo "<input type=\"button\" class=\"cancel_button\" value=\"Cancel\" />";
?>
<input type='hidden' name='parent' value='<?php echo $wparent;?>' />
<input type="hidden" name="method" value="<?php echo $method;?>" />

When I checked the post variables with firebug I saw that, its sending only the method correctly. All other values are sent as undefined. I could not find the error till now.

  • 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-01T01:20:07+00:00Added an answer on June 1, 2026 at 1:20 am

    Try pre-populating the data map that you’re passing:

     $(document).ready(function () {
         $("#post_<?php echo $wparent;?>").click(function () {
             var message = $("[name=replynote]").val();
             var method = $("[name=method]").val();
             var parent = $("[name=parent]").val();
             var data = {
                 "message": message,
                 "method": method,
                 "parent": parent
             };
             $('#parentpost-<?php echo $wparent;?>').html('Loading.....');
             $("#parentpost-<?php echo $wparent;?>").load("<?php echo SITE_URL;?>new_ajax/post_reply.php", data); //end
         }); // end of the main click function
     });
    

    If data is an object containing undefined values, then your jQuery selectors aren’t working.

    Also, since you’re only using a name attribute to find your inputs, you may want to be more specific in the selectors.

    Finally, the attribute selectors typically need the value of the attribute enclosed in quotes, so try these for your selectors:

         var message = $('textarea[name="replynote"]').val();
         var method = $('input[name="method"]').val();
         var parent = $('input[name="parent"]').val();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to submit a form with Ajax here's my simplified code My index:
I am trying to submit a form with method GET and action index.php?id=3. The
here is my script I am playing with jQuery Ajax form submit, without success.
I'm trying to get a submit form without reloading the page. Here's the script:
I'm trying to submit a form and process it with php. Here's what I
i'm trying to submit my Ajax form using jQuery. However calling the submit() function
I am trying to use jquery validator plugin and form submit via ajax in
I am trying to submit a form using Ajax.Updater and have the result of
I'm trying to submit a form with jQuery's $.ajax() function and it works, aside
I'm basically just trying to submit a form through AJAX and want to show

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.