www.webdeveloper.com
Results 1 to 4 of 4

Thread: Form submission before page reload

  1. #1
    Join Date
    Mar 2013
    Posts
    2

    Form submission before page reload

    Hi there

    i have a popup window where i submit a form ... after the form is submitted i want to reload the parent page . I use <form onsubmit :
    Code:
    onsubmit'=>'document.forms[0].submit();window.opener.location.reload(true);window.close();
    but sometimes the form is not submitted and the page is reloaded...so how can i check if the form has finished submission and than to reload parent page and close popup??

  2. #2
    Join Date
    Mar 2009
    Posts
    496
    There may be an easier cross-browser solution but one way that should work everywhere is to have your form not really "submit" at all. Send the data by AJAX and then close the window when the receipt of the data is acknowledged by a message from the server.

  3. #3
    Join Date
    Mar 2013
    Posts
    2
    can you be more specific...

    supose we have a $_POST['name']; and we want to insert or update this input to a db field callled 'name'...
    taking in consideration this example can u explain it more specific

  4. #4
    Join Date
    Mar 2009
    Posts
    496
    Basically the process would consist of:
    (1) grabbing the values set by the user in the form and assembling them in a manner suitable for a POST request (or GET request if you are using that)
    (2) sending the data off to the server via AJAX
    (3) getting a response back from the server and reacting to it.

    Which of these gives you a problem? I don't mind helping but I really hate going into detail about something that the person already knows and understands.

    And also, after this reply I am going down to sleep. Any reply might not be speedy.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles