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

  • Home
  • SEARCH
  • 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 7801031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:49:36+00:00 2026-06-02T00:49:36+00:00

This is really frustrating I would appreciate some help with this. I have a

  • 0

This is really frustrating I would appreciate some help with this. I have a div, called comments and a form inside of that div. What I want to do is post a form to the current page and have it load inside of the div without reloading the entire thing. Here is my current code:

<div id="comments">
<form action="#" method="post" onsubmit="return false;" >
<input type="hidden" name="txtname" value="test">
<textarea id="wysiwyg" name="wysiwyg" rows="5" cols="50"></textarea>
<input type="submit" name="post" id="post" value="Submit">
</form>
<script type="text/javascript">
EDIT: Read edit below for current code
</script>        
</div>

When I submit, the alert fires, but the page does not load. It works fine if I make the event as follows:

$("#comments").load("comments.asp");

It’s not liking the posting of data. I have used .load before but never to post data. I got the above code from these very same forums.

I’m honestly not sure of the purpose of ‘name’ and ‘tel’ – do I refer to those variables or the form variable names when processing the code? This is in ASP classic.

What’s wrong with the above code, how can I get it to send data from the forum via POST? Thanks!

EDIT:
I am now using the following code:

$("#post").submit(function(event){
    var $form = $(this),
        $inputs = $form.find("input, select, button, textarea"),
        serializedData = $form.serialize();
    $inputs.attr("disabled", "disabled");

    $.ajax({
        url: "/comments.asp",
        type: "post",
        data: serializedData,
        success: function(response, textStatus, jqXHR){
            console.log("comment posted");
        },
        error: function(jqXHR, textStatus, errorThrown){
            console.log(

                textStatus, errorThrown
            );
        },
        complete: function(){
            // enable the inputs
            $inputs.removeAttr("disabled");
        }
    });

    event.preventDefault();
});

And now it’s using properly getting the form handled…however it goes to comments.asp. How can I make all the action happen in a certain div (comments div?)

  • 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-02T00:49:37+00:00Added an answer on June 2, 2026 at 12:49 am

    It seems to me you are blending a bunch of different techniques in a way that is not entirely coherent.

    $.post is a shortened version of $.ajax (see here).

    $.load takes a url and sticks it into a <div> or other DOM Element (see here).

    If I understand it correctly (and I may not!), you’re not really wanting to load the form, but put values into the form fields. $.load is an odd way to do this. (It may work, but I do it another way.)

    If you’re using $(#…).submit, you can also leave out a whole bunch of stuff in your form. The following should work fine.

    <form id="form_id">
    ...
    <input type="submit" value="Submit">
    </form>
    

    My method is: (1) have a hardcoded HTML form (or build it by AJAX), (2) get the values from the DB (or wherever) using $.post (or $.ajax), (3) stick the values into the form using .val() (or equivalent – whatever is right for the input type) and the DOM id of that input, and then (4) use .submit (in a manner similar to yours). You will need to add preventDefault as the others have suggested.

    You’re also muddying the waters using #post as the DOM id. You really want to give the form itself the ID, and then use $(#form_id).submit(… I can’t test it now, but having the submit on the input field may cause some grief. The official example attaches the .submit to the form id.

    I’m also not sure the <div> with id ‘comments’ really does much. I have a container id like your ‘comments’, but that’s because I build forms by AJAX and stick them into the container. If you don’t need to do that, the id ‘comments’ is unnecessary to the whole procedure.

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

Sidebar

Related Questions

This is really frustrating, I can't and can't find how to create a form
I have this situation that is really irritating me now. At random times with
This is one of those questions that is really frustrating for me to ask
This really, really urks me, so I hope that someone can give me a
This really seems like a bug to me, but perhaps some databinding gurus can
I've got this really simple piece of code that I thought was the correct
I've been having this really annoying thing happen the past few days, that has
Coming from Java background I am guessing this is expected. I would really love
So frustrating. :P Really would like these to be cached on users' browsers but
Here's a really frustrating Actionscript 2 problem I have with movie clips associated with

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.