The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript submit form value and refresh page

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #185233

    New to this forum.
    I have the following situation:
    I have a form (inside a larger page) that passes a value through ajax to a php file that uses this value in session.
    I use ajax because I don’t want to page to change. I would like the java-script to refresh the page after it sends the data to to the sessions.php.

    the following code requires me to click twice on the submit button (once to send the value and second to refresh)

    the form:
    <form action=”” method=”post” id=”send_id”>
    <input type=”text” id=”state” name=”state” />
    <input type=”hidden” id=”abbrev” name=”id_num” />
    <input type=”hidden” id=”state_id” name=”state_id” /> <br>
    <input type=”submit” name=”submitBtn”value=”עבור לכרטיסיית מועמד/ת” class=”small button” />

    the js
    <script language=”javascript” type=”text/javascript”>
    $(function() {
    $(‘#send_id’).on(‘submit’, function(e) {
    var data = $(“#send_id :input”).serialize();
    type: “POST”,
    url: “sessions.php”,
    data: data,


    Thanks in advance


    Hi all,
    It’s solved.
    Thanks anyway.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.