JSON data table does not upload?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



JSON data table does not upload?



I am trying to pull JSON file and then put in a data table but it is not working and I've looked up similar codes but none work. any help?


<script>
$.getJSON("file.json", function(data)
console.log("just checking");
var items=;
$.each(data, function(key, val)
console.log("double check");
items.push("<tr>");
items.push("<td id='"+key+"'>"+val.system+"</td>");
items.push("<td id='"+key+"'>"+val.status+"</td>");
items.push("</tr>");
items.push("<tr>");
items.push("<td id='"+key+"''>"+val.system+"</td>");
items.push("<td id='"+key+"''>"+val.status+"</td>");
items.push("</tr>");
items.push("<tr>");
items.push("<td id='"+key+"'>"+val.system+"</td>");
items.push("<td id='"+key+"'>"+val.status+"</td>");
items.push("</tr>");
);

$('<tbody/>', html: items.join('')).append('table');
console.log("triple check");
);







Are you providing credentials for that url? Just tried opening it and it says you have to be logged in and response status is 403 which won't go to the success callback
– charlietfl
Aug 6 at 2:15






yes, i have to be logged in but even when i am logged in, it only uploads the <th> but not the <td>
– Karina Turtle
Aug 6 at 2:18





$('<tbody/>', html: items.join('')).append('table');, this will never work
– Leo
Aug 6 at 2:19


$('<tbody/>', html: items.join('')).append('table');





thats exacly how they have it on youtube. what is mission or how can i fix it?
– Karina Turtle
Aug 6 at 2:22





you really should review your code rather than copy/pasting it...items.push("<td id='"+key+"''>"+val.system+"</td>"); you are adding two single-quotes when concatenating the cell ID and that will break your HTML
– Leo
Aug 6 at 2:24


items.push("<td id='"+key+"''>"+val.system+"</td>");




1 Answer
1



Here you go with the solution




$.getJSON("file.json", function(data)
console.log("just checking");
var items=;
$.each(data, function(key, val)
console.log("double check");
items.push("<tr>");
items.push("<td id='"+key+"'>"+val.system+"</td>");
items.push("<td id='"+key+"'>"+val.status+"</td>");
items.push("</tr>");
items.push("<tr>");
items.push("<td id='"+key+"''>"+val.system+"</td>");
items.push("<td id='"+key+"''>"+val.status+"</td>");
items.push("</tr>");
items.push("<tr>");
items.push("<td id='"+key+"'>"+val.system+"</td>");
items.push("<td id='"+key+"'>"+val.status+"</td>");
items.push("</tr>");
);

var joinedItems = items.join('');

$('table').append(joinedItems);
console.log("triple check");
);



Hope this will help you.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard