How do I save the JSON which I'm receiving through ajax to an existing array? I first need to delete everything in my array savedData and save the JSON into that.
Here's the code :-
- function getArticleOnPageLoad() {
- $.getJSON("http://www.myurl.com/myJSON.json", function(data) {
- savedData = data;
- createData();
- }).fail(function(error) {
- console.log("AJAX ERROR: " + error);
- });
- }