dimanche 22 février 2015

Why and when do i need to enqueue my ajax calls in wordpress?


I was wondering something since i am trying to use ajax in wordpress:


Somewhere, i have a pagination using a simple ajax call Ajax pagination wordpress where i don't need to enqueue anything and works fine like this (and there are wordpress functions on the page called, like wp_query to show the posts).


But somewhere else, i call a page with ajax that will load the content from a data attribute url to a specific part of my main page.


On the second case, i couldn't use any wordpress functions inside the called page and that forced me to enqueue my ajax calls (something like that: How to use wordpress functions in an ajax call )


My question is: why and when do i need to be more carefull when i want to use wordpress functions with my ajax calls?


I hope i made myself clear enough..? :)





Aucun commentaire:

Enregistrer un commentaire