# 405 error on post (jquery/JavaScript to php)

**URL:** <https://www.phphelp.com/t/405-error-on-post-jquery-javascript-to-php/36352>\
**Category:** Beginners - Learning PHP\
**Created:** [December 28, 2024, 8:57am UTC](https://www.phphelp.com/t/405-error-on-post-jquery-javascript-to-php/36352 "2024-12-28T08:57:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![temceo](https://www.phphelp.com/letter_avatar_proxy/v4/letter/t/9e8a1a/32.png) [@temceo](https://www.phphelp.com/u/temceo)\
**Post date:** [December 28, 2024, 8:57am UTC](https://www.phphelp.com/t/405-error-on-post-jquery-javascript-to-php/36352/1 "2024-12-28T08:57:33Z")

</div>

Hi  
I am new to PHP and I am trying to learn how to post from input on html (jQuery or JavaScript) via a php file, but I always get a 405 error - not allowed. I am not sure on how to overcome the error. I have looked online and cannot find a solution.

I am working on a linux machine (ubuntu) and I have in installed xampp. This is the link to my files on github -[GitHub - Temceo/php\_test](https://github.com/Temceo/php_test/tree/main)

Any guidance on resolving this issue will be much appreciated. Thank you.

---

<div class="post-metadata">

**Author:** ![phdr](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/91b2a8/32.png) [@phdr](https://www.phphelp.com/u/phdr)\
**Post date:** [December 28, 2024, 9:27am UTC](https://www.phphelp.com/t/405-error-on-post-jquery-javascript-to-php/36352/2 "2024-12-28T09:27:58Z")

</div>

Have you confirmed that php works at all, using a phpinfo(); statement in a .php script file that you request through a URL on the web server, such as [http://localhost/some\_file.php](http://localhost/some_file.php)

Where exactly are you seeing the 405 error and at what point in the process?

---

<div class="post-metadata">

**Author:** ![temceo](https://www.phphelp.com/letter_avatar_proxy/v4/letter/t/9e8a1a/32.png) [@temceo](https://www.phphelp.com/u/temceo)\
**Post date:** [December 28, 2024, 10:51am UTC](https://www.phphelp.com/t/405-error-on-post-jquery-javascript-to-php/36352/3 "2024-12-28T10:51:12Z")

</div>

Hi, thanks for checking.

I am seeing the 405 error in the browser inspect section (under console and network) on the html page.

Regarding the php page, I have confirmed that it works. I have connected to an external api (openweather) and I am successfully retrieving data from the external api to the php page.

I am only encountering the 405 error whenever I collect input from the html page (using jquery/JavaScript) and try to post it to the php page.

---

<div class="post-metadata">

**Author:** ![phdr](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/91b2a8/32.png) [@phdr](https://www.phphelp.com/u/phdr)\
**Post date:** [December 28, 2024, 1:06pm UTC](https://www.phphelp.com/t/405-error-on-post-jquery-javascript-to-php/36352/4 "2024-12-28T13:06:22Z")

</div>

What URL are you entering in the browser for the html page? It should be something like [http://localhost/index.html](http://localhost/index.html) or if the web server is setup with a default document for index.html, just using [http://localhost](http://localhost) will work.

Could you post a screen-shot of what you are seeing in the browser’s developer tools?

---

<div class="post-metadata">

**Author:** ![temceo](https://www.phphelp.com/letter_avatar_proxy/v4/letter/t/9e8a1a/32.png) [@temceo](https://www.phphelp.com/u/temceo)\
**Post date:** [December 28, 2024, 4:37pm UTC](https://www.phphelp.com/t/405-error-on-post-jquery-javascript-to-php/36352/5 "2024-12-28T16:37:29Z")

</div>

Hi  
I have worked out the issue. I am using vs code live server which does not support posting to php. I don’t encounter this issue when I use the built in php web server.

Thanks for your help.
