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

WordPress

Jason Narciso
Jason Narciso
4,763 Points

Simple AJAX Request

I have a VERY basic form which takes a select element's option value and stores it in a variable. The variable is then used in another call to change data displayed on screen.

(So the option passes an "event" ID, and when changed, a list of events below will be updated.)

The form has to be "submitted" for this to run. All I need to do is submit the form via AJAX so the screen doesn't get refreshed and store the most recent option as "selected".

From my initial research, it seems using AJAX with WordPress is a bit complicated. Can someone point me in a direction for this seemingly simple example?

Could you post an example of your code?