separating my jquery code to javascript file

Hi guys, I was planning to separate my javascript into its own file, but I received an error because of the “url:ajax.ajax\_url” since this code is PHP. Do you guys have an idea how to prevent this error?

https://preview.redd.it/1gx805ej13ea1.png?width=2083&format=png&auto=webp&v=enabled&s=504dafeff613d7559d9c66aa737a5f389915cae1

1 Comment
  1. You need to define your file in your child theme with the wp_enqueue_script function.

    This function must been add in your functions.php

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer