Transcript from the "Q&A" Lesson
>> Zac Gordon: So, are there any questions before we take a break at this point, in terms of AJAX?
>> Audience Member: Mira, just saying looking for the solution on frontend main JS, which you kinda already showed, right?
>> Zac Gordon: For frontend main for the jQuery one? Yeah, that was what we just went over.
>> Audience Member: Right, yeah, so she can catch up on the video there, and then can we make the short code go to the API? I'm not sure what [CROSSTALK] just saying short codes.
>> Zac Gordon: So, there this is a place where, man, I need to give some context to explain what they're asking.
[00:00:45] So, in Wordpress, there are what are called short codes, and these are things that, I forget the exact format of, no, it's not that. In the content editor, let's say you wanted to do a grid that was two columns, right? You can't actually throw in all the and all that stuff there.
[00:01:09] So, there's a format of using what are called shortcodes in WordPress, and you can, in PHP, I think it's something like this. Or another one might be a contact form. So because this is PHP that's generated, you can't just pass it in with the localized script and necessarily expect it to work, because this is gonna fire off a bunch of stuff.
>> Zac Gordon: And see what you get.
[00:02:18] I don't My guess is that that is not gonna work, but it may. I'd be curious.
>> Audience Member: And my row was just asking about that rpelacement for a response. It's JS for WP underscore globals, right?
>> Zac Gordon: Yes. It is. It's exactly what we set right here.
>> Audience Member: Instead of the response from the initial load.
>> Zac Gordon: Yep for the initial load because we're getting that from here, and we don't get a response back till after we make the jQuery call, the response is going to come inside of that. Sorry let me just pull up.
>> Zac Gordon: Yeah. So, we can't use response until we get the success back, then we could use response.total_likes.
[00:03:05] Before this ajax call is made, we have to depend on the global variables that we set up of total likes and that comment was wrong, so I'll make sure that gets fixed.