Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function test(){
- echo '123';
- die();
- }
- add_action('wp_ajax_test', 'test');
- add_action('wp_ajax_nopriv_test', 'test');
- ====== AJAX
- $('#gift_pillow').on('click',function(e) {
- e.preventDefault();
- console.log(ajaxurl);
- $.ajax({
- url: ajaxurl,
- type: 'POST',
- data: {
- action:'test'
- }
- }).done( function (response) {
- console.log(response);
- if( response.error != 'undefined' && response.error ){
- return true;
- } else {
- window.location.href = '/cart/';
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement