I'm trying to display JSON data using jQuery from a Codeigniter controller. I've already created a JSON URL (http://www.tgttest.jeffreyteruel.com/location/locales), and also have the same data on my WAMP server. What I'm having problems is getting the data to display. It works if I take the same JSON data and place it on a .json file, but I'm looking to get it from a Controller/MySql database.
My code is below:
$.getJSON('http://www.tgttest.jeffreyteruel.com/location/locales', function(data) {
var output="<ul>";
for (var i in data.locales) {
output+="<li>" + data.locales[i].location_id + " " + data.locales[i].location_title + "</li>";
}
output+="</ul>";
document.getElementById("placeholder").innerHTML=output;
});
It's been a while since I've dealt with AJAX so my skills are rusty. Any help to get the data from the URL is greatly appreciated.