Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Martin Park](https://uploads.teamtreehouse.com/production/profile-photos/3883052/micro_mp.png)
Martin Park
12,792 PointsHow to combine fetch() POST method with php?
Hi was wondering if anyone could help point me in the right direction. I know how to connect to a db and pass/retrive data with php.
I now know how to use fetch() to POST data using javascript.
Just not entirely sure how I connect the 2 different languages? Would I create a separate .php file with the required php function then use that url as the target in fetch()?
If there is a workshop/track for this, then I'd be keen to watch it :)
Thanks in advance
2 Answers
![Martin Park](https://uploads.teamtreehouse.com/production/profile-photos/3883052/micro_mp.png)
Martin Park
12,792 PointsThanks for the reply James. I have just finished the AJAX course but it doesn't cover how to link to PHP. I'll keep looking.
Also trying to avoid Jquery as quite a few people advised that new Javascript updates mean Jquery is out of date. So trying to learn to do the above using vanilla Javascript.
![jamesjones21](https://uploads.teamtreehouse.com/production/profile-photos/9483372/micro_11813500_10156054945055144_3499832327951416355_n.jpg)
jamesjones21
9,260 PointsThere is a technique called Ajax where you can post the form data using javascript to php
You can use Jquery: https://www.w3schools.com/jquery/jquery_ref_ajax.asp
hope this helps :)
jamesjones21
9,260 Pointsjamesjones21
9,260 PointsI tend not to use Jquery as much as possible, but its what they use in work -_-, but there is a JS class which you can intantiate which is HTTPRequest() then that should allow you to start using Ajax.
hope it goes well.