I'm not very confident in AJAX unfortuantely,
Im looking to call the current post URL via ajax.
Do you have any idea how is this possible ?
So far I'm trying the following, no success . .
$(document).on('click', '.send', function(e) {
$.ajax({
url: ajaxpagination.ajaxurl,
type: 'POST',
dataType: 'json',
data: ({
pageurl: the_slug(),
userEmail: userEmail
}),
success: function( data ) {
alert( 'Your home page hurl' + $(pageurl);
}
})
--EDIT --
From the comment of mmm I have added the script in functions.php and then callign it like below:
$(document).on('click', '.link', function(e) {
var $this = $(this),
category = $this.attr('data-event-category'),
action = $this.attr('data-event-action'),
label = $this.attr('data-event-label'),
permalink = object["permalink"]
self.track(category, action, label);
console.log('tracking pushed: '+category+', '+action+', '+permalink)
});
},
Doesn't seems to be sucessfull, I'm having an object is not defined . .