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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:55:17+00:00 2026-06-05T04:55:17+00:00

i was searching google just to have way out to generate & submit form

  • 0

i was searching google just to have way out to generate & submit form by jquery and i found code snippet but few things was not clear to me.

function submitValues(url, params) {
var form = [ '<form method="POST" action="', url, '">' ];

for(var key in params) 
    form.push('<input type="hidden" name="', key, '" value="', params[key], '"/>');

form.push('</form>');

jQuery(form.join('')).appendTo('body')[0].submit();
}

why [] this third bracket is used like

var form = [ '<form method="POST" action="', url, '">' ];

what is the meaning of the line jQuery(form.join(”)).appendTo(‘body’)[0].submit();
why form.join(”) has been used and why write like appendTo(‘body’)[0] why [0]

please guide me in detail for those above bold syntax. thanks

  • 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-05T04:55:20+00:00Added an answer on June 5, 2026 at 4:55 am

    By questions order:

    1. Brackets [] define an array. So in the second line it defines array with three items:

      var form = [ "first item", "second item", "third item", ... etc ];
      
    2. form.join('') joins all the elements of form array with delimiter of empty string, so form becomes a string with concatenated substrings from the array.

    3. jQuery(form.join('')) converts your string into DOM elements and appendTo("body") appends these elements (<form><input> ... </form>) inside body.

    4. Using [0] you get your form, however not as a jQuery object but as DOM element. Native form element has method submit which is called with .submit().

    For any doubts with native JavaScript methods and functions you can read MDN. jQuery documentation is provided at api.jquery.com.

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

Sidebar

Related Questions

I have tried searching on Google and also read the documentation but no success.
I know this question can be answered by searching in google. But I have
I have been searching around using Google but I can't find an answer to
After google searching, searching this site as well as jQuery found there was no
I've spent the last few days banging my head and searching Google and have
I tried searching in google but could not find any useful answer, if(verifier.length() >
I've been searching on Google for a resolution to this problem, but cannot find
Where does one go to report bugs in Google Code? Alas, searching for Google
I have been having some trouble finding a good way to output just the
I'd been searching for a way to do cookie based authentication/sessions in Google App

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.