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
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 :-)