简体   繁体   中英

Getting 405 error when trying to send email in form

I'm trying to make myself a website, and found an awesome template online that could be used for free, but I can't get the email contact form to work. Here is a link to the error, and here is a link to my website. I'm familiar enough with Web Dev that I can make basic websites with JS, but I've never used a php file. I've put my email in the php file, but past that, I don't really know how to go about this. Here I've provided the JS and php code relating to this question.

      $.ajax({
      type: "POST",
      url: "/inc/sendEmail.php",
      data: data,
      success: function(msg) {` 

(Just putting code here because it wont let me post a codepen link without posting code with it, which I don't quite understand). Also, a link to the github repository can be found here . I've tried everything I can think of, but can't seem to figure it out.

Thanks

GitHub pages can only serve static content, and there is no way to run PHP on GitHub pages or upload things. That's why GitHub doesn't allow POST requests.

If you need server side scripting (Eg PHP), you'll need to use a web host which offers these things.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM