How to submit the page by JavaScript

0

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
    0
    Lola Gill 6.70K 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:

    $(document).ready(function(){
    $(“.sg-button-bar”).hide();
    $(“#sg_NextButton”).click();
    $(“#sg_SubmitButton”).click();
    });

    Hope this helps!

    Lola Gill answered
      ×

      Login

      Question stats

      • Active
      • Views324 times
      • Answers1 answer
      • Followers1 follower