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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:53:10+00:00 2026-05-27T21:53:10+00:00

Trying to create and submit form within a javascript call. This code works fine

  • 0

Trying to create and submit form within a javascript call. This code works fine on Chrome but doesn’t on Firefox and IE. I first get values from Ajax call (JSON) and then submit it as a form

$('<form name="acsform" action="' + JSONobject.formacsurl +'" method="POST">' + 
  '<input type="hidden" name="PaReq" value="' +JSONobject.formpareq + '">' +
  '<input type="hidden" name="TermUrl" value="'+ JSONobject.formtermUrl +'">' + 
  '<input type="hidden" name="MD" value="'+ JSONobject.formmd +'">' +
  '</form>').submit();

Any ideas?

Just to add… when I alert some text a line below that submission, I get the alert box on the screen. It may seem like browser goes through that code fine (perhaps even submits the form) but I’m not being redirected to forms action address. I don’t get any JS errors either.

Once again, it fails only on Firefox and IE, Chrome does submission plus redirection fine.

  • 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-27T21:53:11+00:00Added an answer on May 27, 2026 at 9:53 pm

    Try this code:

    $(document).ready(function()
    {
        /*
        *    IF IS APPEND, USE A ID OR CLASS
        */
        $('#X').append('<form id="myNewForm" class="myNewForm" method="post" action="">...</form>');
        $('#myNewForm').submit();
    
        //OR USE CLASS NAME
        $('form.myNewForm').submit();
    
        /*
        *    IF NOT APPEND, USE A ID OR CLASS
        */
        //USEA ID
        $('#myForm').submit();
    
        //USE A CLASS NAME
        $('form.my-form').submit();
    
        //USE A ELEMENT( ALL )
        $('form').submit();
    
    });
    

    Bye!

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

Sidebar

Related Questions

I'm trying to create a registration form with Rails. It's working, but it doesn't
I'm trying to create a basic submit form (like the dajaxice's example) but i
I'm trying to dynamically create a form using JQuery. In order to do this,
I'm trying to create a JSON object on form submit to pass to Perl.
i am trying to create a login form page for codeigniter 2 within sencha
Im trying to create a form that submits to a certain action within the
I'm trying to create a form using Spring @MVC 3.0. This form is supposed
I am trying to create some random unicode strings within javascript and was wondering
Trying to create a user account in a test. But getting a Object reference
Thank you for reading. I'm trying to create a HTML form so that my

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.