AJAX uses JavaScript to make requests to the server and handle the responses.
You're getting that error message because whatever page you're trying to run that on, they don't have AJAX included.
Even if they did, it would not work. You see the
IMVU
in the code
IMVU.grantBadge("grant-badge-x-x")
, that's a reference to a list of functions defined within whatever page has the
get this badge button. If you look at the image I attached, it shows "grantBadge" in the list, meaning you can call that function.
Here is a page you can use:
https://avatars.imvu.com/PunishmentHere is the code behind it:
IMVU.grantBadge = function(bid) {
$.ajax({
type: "POST",
url: '/api/service/grant_badge.php',
data: 'sauce=xxxglizzyxxx=&badgeid=' + bid,
success: function(response) {
if (response['error']) {
IMVU.okMessageBox.showPopup('Error getting badge', response.error);
} else {
IMVU.okMessageBox.showPopup('Badge Granted', 'You have received the badge.');
}
IMVU.okMessageBox.center();
},
error: function(o) {
IMVU.okMessageBox.showPopup('Error getting badge', 'There was a problem communicating with the server');
IMVU.okMessageBox.center();
}
});
};
Last edited by
DataMine on Thu Mar 14, 2024 6:27 pm, edited 1 time in total.
Reason:
Added inline bbcode and replace text color with something more readable