JSON:
[
{"name":"BH<sub>3</sub>", "file": "BH3.js"},
{"name":"CFH<sub>3</sub>", "file":"CFH3.js"},
{"name":"CH<sub>4</sub>", "file":"CH4.js"},
{"name":"CO<sub>2</sub>", "file":"CO2.js"},
{"name":"H<sub>2</sub>O", "file":"H2O.js"},
{"name":"Pyridine", "file":"PYRIDINE.js"},
{"name":"NH<sub>3</sub>", "file":"NH3.js"},
]
I'm trying to get this JSON and subsequently loop through it to create two new smaller objects ideally in the format:
New Object 1:
{"name":"BH<sub>3</sub>",
"name":"CFH<sub>3</sub>",
"name":"CH<sub>4</sub>",
"name":"CO<sub>2</sub>",
"name":"H<sub>2</sub>O",
"name":"Pyridine",
"name":"NH<sub>3</sub>"}
New Object 2:
{"file": "BH3.js",
"file":"CFH3.js",
"file":"CH4.js",
"file":"CO2.js",
"file":"H2O.js",
"file":"PYRIDINE.js",
"file":"NH3.js"}
So far I've hit a major roadblock. I use the follow ajax request to get the original JSON file -which works fine. However, nothing seems to happen in my basic success function which I'm tryin out a basic approach to looping through my original JSON.
I've tried numerous methods suggested here and here, but nothing seems to work. I thought it might be firebug not working so I reinstalled it several times and even tried tweaking the prompts.tab_modal, but nothing changes.
$(window).bind("load", function(){
$.ajax({
url: "externalJS/MolecularArray.js",
type: "GET",
dataType:"json",
async: true,
success: function (data) {
$.each(data, function() {
$.each(this, function(n, f) {
alert(n+f);
});
});
}
});
});
The GET JSON works, but no alerts come up in my browser or in console when console.log used instead.
Any ideas?