Created
December 16, 2020 09:14
-
-
Save fahidjavid/b213461d38a3b307a2ea58d9e7dd3267 to your computer and use it in GitHub Desktop.
ajaxurl JS variable can be used for the WP admin ajax URL in any JS file of the RealHomes theme now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var add_to_favorite_options = { | |
type : 'post', | |
url : ajaxurl, // This is how we can use the 'ajaxurl' variable for the WordPress ajax URL. | |
data : { | |
action: 'add_to_favorite', | |
property_id : propertyID, | |
}, | |
success: function(response) { | |
if('false' !== response) { | |
$(favorite_link).addClass('hide'); | |
$(span_favorite).delay(200).removeClass('hide'); | |
} | |
} | |
}; | |
$.ajax(add_to_favorite_options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment