Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

142
Views
Submit form and then after the form is processed open a new page

I'am trying to delete an entry/offer from the database and then get back to all the entries/offer overview page. I tried to do it with Javascript but unfortunately it does not open the overview page. It does the deleting but then stays on the page.

Is that the correct way anyways with javascript?

Here the two links Overview and delete Offer

<a id="overview" href="/mbm-kalkulation">Overview</a>
<form method="post" action="/?id='.$_REQUEST["id"].'" name="delOffer"><button type="submit">delete Offer</button>

Here the javascript which should click the overview page after the form got submitted.

((isset($_REQUEST["delOffer"]))?'
            setTimeout(function(){
                jQuery("a#overview").click();
            }, 1000);
        ':'')
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Normally such redirects are done using the header function from php. This is only possible, when the headers weren't already send. In this case you will have to use a JavaScript fallback. The code could look something like this:

if (isset($_REQUEST["delOffer"])) {
  if (!headers_sent()) {
    header("Content-Type: text/plain");
    header("Location: {$url}");
  } else {
    print "<script>window.location = '" . addslashes($url) . "';</script>";
  }

  exit;
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!