Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Adding Ajax to Plugins on the Front End, Code Challenge Task 3
I'm having trouble with this code challenge task. After some trial and error, I got the hint that I needed to include a third argument for an array of dependencies. I don't remember this being discussed at all, and I've looked through all the recent videos and can't find it. Can someone point me to the place where this concept was explained?
Also, when I do try to put any kind of array as the third variable [so far I've only tried array( 'jquery' ) ], it tells me to check the file path for the js file. I'm 90% sure I have that part right, because it works until I add the array.
Anyway, any insight would be appreciated. Thanks.
Chad Pjontek13,700 Points
There is not quite enough information regarding the file path in the question on this step. It is inferred from the previous step that it is in the
The code should look like this:
wp_enqueue_script( 'my_plugin_frontend_js', plugins_url( 'my-plugin/js/front-end.js' ), array('jquery'), '', true );
When I ran the code challenge again to get my code for you, it all worked fine this time.
Richard Nash24,862 Points
Yes, ran into this as well. I don't remember the last bit of information being covered anywhere in the videos... thanks Chad :-)