Redirect PHP contact form to another page upon success [closed]

走远了吗. 提交于 2019-12-02 12:15:13

Since you're POSTing via Ajax, you should redirect from the client-side, after returning success or error.

I didn't need to update php file. This worked by editing the js file around line 30: Need to change the success callback to:

//send the feedback e-mail
    $.ajax({
      type: "POST",
      url: "library/sendmail.php",
      data: $("#feedbackForm").serialize(),
      success: function(data)
      {
     //CHANGE TO YOUR REDIRECT URL HERE
      window.location.href = "http://www.redirectgoeshere.com";
      },
      error: function(response)
      {
        contactForm.addAjaxMessage(response.responseJSON.message, true);
      }
   });
    return false;
  });
});

Try Location: instead

    {
    header('Location: success.php');
    }
    else {
    header('Location: resubmit.php');
  }
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!