Timeline for Use ajax without a plugin?
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 20, 2016 at 3:42 | comment | added | Tom J Nowell♦ |
Look into wp_localize_script , it's how you're meant to pass data from PHP to javascript. You're meant to use it instead of echo'ing it out. Consider asking a new question about what it does and why you would use it for a more indepth answer
|
|
Mar 15, 2016 at 23:48 | comment | added | mesqueeb |
Thanks Tom! I'll rename the hook. About the wp_localize_script I'm not sure what you mean... Maybe it has something to do with doing something with the data returned from AJAX? Maybe this is the same problem I'm having here: stackoverflow.com/questions/36006058/… I cannot access the data to use in a table... If you have some time it would be great if you could have take a look.
|
|
Mar 15, 2016 at 17:25 | comment | added | Tom J Nowell♦ |
Where are you hooking up the 2 functions though? They're very generic and similar to an existing API, you should prefix them or namespace them. Also you should use wp_localize_script to pass in the AJAX endpoint URL and the nonce rather than outputting it inline via PHP
|
|
Mar 14, 2016 at 16:43 | history | answered | mesqueeb | CC BY-SA 3.0 |