How to submit the page by JavaScript


I want a JavaScript to submit the page automatically after executing some code. It’s of course possible to submit a page by $(‘input[type=submit]’).click(), which “simulates” a click on the submit button.

But if there are 2 or more subsequent pages with the same JavaScript code, the program does not proceed properly to the next pages, but jumps back to the first page where this “simulated submit” function has been executed. (e.g. page 1 – page 2 – page 1). Does anyone know the reason for this funny effect?

Lola Gill answered
    Lola Gill 6.99K Rep.

    I’m really not sure why you would be getting the effect you described (maybe you have some logic on these pages?).

    I’ve used this script in the past without issue:


    Hope this helps!

    Lola Gill answered


      Question stats

      • Active
      • Views5404 times
      • Answers1 answer
      • Followers1 follower