-1

My form have different ID, because use for save informations, and use jquery for manage these forms and submit with jquery

My question it´s about how i can, after submit, resend some data as for example ID with a value and send as post

jQuery("#form_config").submit();

I send form and all works, but when save information i need reload this form but also send some input hidden generate during the process and reload this form with this new informations or values send after send form with jquery by post also

I need know how send values inside this .submit() to the form

Thank´s

Özgür Can Karagöz
  • 1,039
  • 1
  • 13
  • 32
Anton
  • 17
  • 5
  • For jQuery, there are methods like ajax, post, get. You can find it by searching within the site. https://stackoverflow.com/questions/5004233/jquery-ajax-post-example-with-php – Özgür Can Karagöz Dec 08 '17 at 18:44

1 Answers1

0

Your question was poorly worded but this might help you repopulate the form after submission.

jQuery("#form_config").submit(function(event){
        event.preventDefault();

        //insert whatever you want to "send some input hidden generate during the process"

        //then

        //jQuery("#fieldOneId").val("values inside this .submit() to the form")
        //jQuery("#fieldTwoId").val("values inside this .submit() to the form")
        //jQuery("#fieldNId").val("values inside this .submit() to the form")
    }

Edit:

still unsure of your question but this works for what I believe you are asking.

<body>

  <form>
    <div>
      <input id="first" type="text"><br>
      <input id="second" type="text"><br>
      <input type="submit">
    </div>
  </form>


  <script>
  $( "form" ).submit(function( event ) {
    const first = $( "#first" ).val()
    const second = $( "#second" ).val()
    $("#first").val(second)
    $("#second").val(first)
    event.preventDefault();
  });
  </script>
</body>
R. Jaynes
  • 1
  • 1
  • Jquery val give me value from input by id, but i want resend values as post to the form using submit, this no has sense – Anton Dec 08 '17 at 18:39