Here I have a code that for some reason Does not pop up any errors but it also does not do what I want it to do which is pull up a list of all the reference Id's from this json file
$(function() {
{
$.ajax({
url: "https://www.bungie.net/Platform/Destiny2/2/Account/4611686018429000034/Character/0/Stats/UniqueWeapons/",
headers: {
"X-API-Key": apiKey
},
success: function(data) {
let
NameT = jsonPath("$.Response..referenceId");
$('#player-NameT').text(NameT);
console.log(NameT);
},
});
}
});
here is the json data
{
"Response": {
"weapons": [
{
"referenceId": 2208405142,
"values": {
"uniqueWeaponAssists": {
"statId": "uniqueWeaponAssists",
"basic": {
"value": 0.0,
"displayValue": "0"
}
},
"uniqueWeaponAssistDamage": {
"statId": "uniqueWeaponAssistDamage",
"basic": {
"value": 0.0,
"displayValue": "0"
}
},
"uniqueWeaponKills": {
"statId": "uniqueWeaponKills",
"basic": {
"value": 1117.0,
"displayValue": "1117"
}
},
"uniqueWeaponPrecisionKills": {
"statId": "uniqueWeaponPrecisionKills",
"basic": {
"value": 1.0,
"displayValue": "1"
}
},
"uniqueWeaponKillsPrecisionKills": {
"statId": "uniqueWeaponKillsPrecisionKills",
"basic": {
"value": 0.00089525514771709937,
"displayValue": "0%"
}
}
}
},
{
"referenceId": 2232171099,
"values": {
"uniqueWeaponAssists": {
"statId": "uniqueWeaponAssists",
"basic": {
"value": 0.0,
I added the json data in here .
It is only a sample of it as the full amount it over 79k characters .
I Hope this might will help you. Can you please also share your JSON response in which you are getting an error response.
$(function() {
{
$.ajax({
dataType: "json",
url: "https://www.bungie.net/Platform/Destiny2/2/Account/4611686018429000034/Character/0/Stats/UniqueWeapons/",
headers: {
"X-API-Key": apiKey
},
success: function(data) {
var weaponCollection = $.parseJSON(data);
if( weaponCollection.length != 0 ){
console.log(weaponCollection.Response.weapons);
}
},
complete: function(data){
console.log(data);
},
error: function(error){
console.log("Error:");
}
});
}
});
you will get referenceId
from below code, if the ID is more than one you can run the loop and get the other id also
$(function() {
{
$.ajax({
url: "https://www.bungie.net/Platform/Destiny2/2/Account/4611686018429000034/Character/0/Stats/UniqueWeapons/",
headers: {
"X-API-Key": apiKey
},
success: function(data) {
var NameT =data;
console.log(NameT.Response.weapons[0].referenceId);
},
});
}
});``