Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

This data on console $(this).serialize() gives me the result below, I wanted to submit it on load not on click and pass a select default value programatically(currency_code) -- the form is a built in library

 _method=PUT&source=geolocation_recommendation&return_to=%2F&currency_code=PHP

This is my code on click

$(document).ready(function () {

    $(document).on("submit", "form.locale-bar__form", function (e) {
       e.preventDefault();
        let data = $(this).serialize()
        console.log('>>>>', data)
      });
    });

Form looks like this

enter image description here

question from:https://stackoverflow.com/questions/66060310/submit-form-with-data-on-load

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
106 views
Welcome To Ask or Share your Answers For Others

1 Answer

Am I missing the point or is this not doing its job? :

$(document).ready(function(){
  $(".locale-bar__form").submit();
});

edit: might find your solution here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...