2019-03-07, 19:50:58
(2019-03-07, 09:26:06)Tyblitz Wrote: @vish93
If you are going to do it with your own plugin (which would indeed be better than in the theme folder),
GS provides some functions for handling AJAX together with auth (requestIsAjax
,get_cookie
, andcheck_nonce
)
I do AJAX saving in my plugin Components Extended (see my signature below), you can look at the code for inspiration, see this excerpt for example:
PHP Code:$global $USR;
if (requestIsAjax()) {
// protect against CSRF, basic check
if (!isset($USR) || $USR != get_cookie('GS_ADMIN_USERNAME'))
die();
// only continue if the request comes from the same domain & nonces match
if (empty($_GET['nonce']) || !check_nonce($_GET['nonce'], 'components_ext_action', 'components_ext.php'))
die();
}
Thank you ever so for the response. I am going to use the plugin for storing/keeping track of responses from the form. For the ajax post where should I be point the url to?