Create and access custom PHP function from jQuery post in Wordpress -
i have custom js file runs in head of wordpress installation successfully. need run jquery post request file php file can return value database.
where create php function? have used functions.php file add custom js file start with, don't want new function run every page load, when requested.
once i've created php function wherever, how access through jquery post request? i'm used using local paths wordpress screws up!
i'm finding feet in wordpress. reasonably capable developer in codeigniter etc wordpress seems make obscure , overly complicated! appreciated!
edit -------------
i have created custom functions file in plugins folder per this article) need know how access function within file js file in header!
if understand correctly, trying use jquery http post request wordpress app when event happens in browser. technique known ajax (asynchronous javascript , xml). javascript in browser communicates server without refreshing page , can more logic want (in javascript/jquery) based on response server. server can response more xml these days (json pretty popular).
ajax in wordpress: standard xml response
ajax in wordpress plugins: response using jquery. can in theme instead of plugin. looking for.
edit: straightforward ajax example using jquery , wordpress.
Comments
Post a Comment