Title: How to call a php file using Javascript?
Last modified: August 9, 2024

---

# How to call a php file using Javascript?

 *  Resolved [michalrama](https://wordpress.org/support/users/michalrama/)
 * (@michalrama)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/how-to-call-a-php-file-using-javascript/)
 * Hello,
 * I wrote my own code in php that I wanted to call in javascript. The problem is
   that I can’t find the URL.
 *  Where does the plugin store the files please?
 * Thank you

Viewing 1 replies (of 1 total)

 *  Plugin Author [Mircea Sandu](https://wordpress.org/support/users/gripgrip/)
 * (@gripgrip)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/how-to-call-a-php-file-using-javascript/#post-17944589)
 * Hi [@michalrama](https://wordpress.org/support/users/michalrama/),
 * WPCode stores code snippets in the database so there’s no direct URL for you 
   to access.
 * You won’t be able to access PHP files that way from JavaScript in WordPress. 
   You will need to use AJAX in order to execute PHP scripts from JavaScript and
   use their output.
 * WordPress has a pattern that I recommend using when trying to achieve this but
   you will need to understand how AJAX requests work in JavaScript, you can read
   more here: [https://developer.wordpress.org/plugins/javascript/ajax/](https://developer.wordpress.org/plugins/javascript/ajax/)

Viewing 1 replies (of 1 total)

The topic ‘How to call a php file using Javascript?’ is closed to new replies.

 * ![](https://ps.w.org/insert-headers-and-footers/assets/icon-256x256.png?rev=2758516)
 * [WPCode - Insert Headers and Footers + Custom Code Snippets - WordPress Code Manager](https://wordpress.org/plugins/insert-headers-and-footers/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-headers-and-footers/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-headers-and-footers/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-headers-and-footers/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-headers-and-footers/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-headers-and-footers/reviews/)

## Tags

 * [file](https://wordpress.org/support/topic-tag/file/)
 * [url](https://wordpress.org/support/topic-tag/url/)

 * 1 reply
 * 2 participants
 * Last reply from: [Mircea Sandu](https://wordpress.org/support/users/gripgrip/)
 * Last activity: [1 year, 10 months ago](https://wordpress.org/support/topic/how-to-call-a-php-file-using-javascript/#post-17944589)
 * Status: resolved