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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:20:42+00:00 2026-05-24T06:20:42+00:00

I have the following function: // open a new window. Create and submit form

  • 0

I have the following function:

// open a new window. Create and submit form
function createSubmitForm(response) {
    var external = window.open('about:blank', 'external');
    var doc = external.document;
    var body = $('body', doc);

    // create a new form element
    var form = $("<form id='authForm'></form>");
    // set the form's attributes and add to iframe
    form.attr("action", response.action)
        .attr("method", response.method);
    form.appendTo(body);

    // create form elements;
    for (var i = 0, len = response.fields.length; i < len; i++) {
        var field = response.fields[i];

        if (field.name != "") {
            $("<input type='hidden'/>")
                .attr("name", field.name)
                .attr("value", field.value)
                .appendTo(form);
        }
    }
    // submit the form
    form.submit();
}

When I try to execute it, I get an “Unspecified Error” at form.appendTo(body).

What could I be doing wrong here?

  • 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-24T06:20:43+00:00Added an answer on May 24, 2026 at 6:20 am

    Try this:

    Please notice that You must have a blank page on Your server http://localhost/some-blank-page-on-your-server.php

    <!DOCTYPE html>
    <html>
    <head>
    <script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <meta charset=utf-8 />
    <title>JS Bin</title>
    <!--[if IE]>
      <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <style>
      article, aside, figure, footer, header, hgroup, 
      menu, nav, section { display: block; }
    </style>
    </head>
    <body>
    
    </body>
    <script>
    (function($) {
    $(function() {
        // open a new window. Create and submit form
        function createSubmitForm(response) {
            var external = window.open('http://localhost/some-blank-page-on-your-server.php', 'external');
    setTimeout(function() {
            var doc = external.document;
            var body = $('body', doc);
    
            // create a new form element
            var form = $("<form id='authForm'></form>");
            // set the form's attributes and add to iframe
            form.attr("action", response.action)
                .attr("method", response.method);
    
    
            // create form elements;
            for (var i = 0, len = response.fields.length; i < len; i++) {
                var field = response.fields[i];
    
                if ( field.name !== "" ) {
                    $("<input type='text'/>")
                        .attr("name", field.name)
                        .attr("value", field.value)
                        .appendTo(form);
                }
                $("<input type='submit' value='submit' />").appendTo(form);
            }
            // submit the form
            form.submit();
    
            body.append(form);
    }, 1000);
        }
    
        createSubmitForm({
          action: 'http://www.example.com',
          method: 'get',
          fields: [{
            name: 'field1',
            value: 'some value'
          }]
        });
    });
    })(jQuery);
    </script>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following javascript: $('#ge-display').click(function (event) { window.open('/googleearth/ge-display.php','','scrollbars=yes,menubar=no,height=650,width=1000,resizable=yes,toolbar=yes,location=no,status=no'); event.stopPropagation(); return false; }); the
I have the following function: CREATE FUNCTION fGetTransactionStatusLog ( @TransactionID int ) RETURNS varchar(8000)
I have the following code. var d3_ad = 1; function displayD3Ad(){ var query_string =
I have the following function to make a popup window. function makewindows(html){ child1 =
My main HTML page does the following: var popup = window.open(...); // Wait for
I have the following code: (function(){ var DS = (function(){ DS.prototype.queryDB = function() {
I have the following function that is pulling data from a database. The ajax
I have the following function: //Function to get random number public static int RandomNumber(int
I have the following function: - (NSString *)urlEncodedValue { NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes(
I have the following function void initBoard(int * board[BOARD_ROWS][BOARD_COLS]){ int z = 0; for(

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.