I'm making an Ajax call in an Elementor site, and I'd like to use a nonce while doing it. Since my code is really simple, I didn't create a new JS file for it placed in Elementor's HTML widget, and I handle the request in the functions.php
file.
I realized that the best way is to use wp_localize_script
to make both the nonce and the Ajax URL available in the client side, but the function is asking for a file to register, and I don't know how to approach this, since there is no file to register and enqueue, functions.php
is probably already enqueued?
How is it done? I've already read through so many tutorials and still didn't find that answer.
Any knowledge will be of great help. Many thanks.