I’m trying to code a dynamic phonegap app that retrieves and format information from a live database.
I use jsonp to get data from a php service I coded.
[CODE]$(document).ready(function(){
var output = $(‘#output’);
$.ajax({
url: ‘http://example.com/service.php’,
dataType: ‘jsonp’,
jsonp: ‘jsoncallback’,
timeout: 5000,
success: function(data, status){
//data loaded
$.each(data, function(c,comp){
window.alert(comp.filter); // I added this just to check I was getting data correctly.
var company = ‘<div class=”project-post ‘ +comp.filter+ ‘ “>’
+'<img src=” ‘ +comp.img+ ‘ “>’
+'<div class=”hover-box”>’
+'<div class=”project-title”>’
+'<div><a href=”coupons.html?id=’+comp.id+'” rel=”external”><i class=”fa fa-arrow-right”></i></a></div>’
+'</div></div></div>’;
output.append(company);
});
},
error: function(){
//error loading data
output.text(‘Error loading data.’);
}
});
});
My console doesn’t display any errors, I’ve been trying to solve this for a long time. I have this in my config:
<access origin=”*” />
Also I confirmed I was receiving data with window.alert(comp.filter); It’s just not displaying at all, maybe something’s wrong with my formatting but can’t figure out what it is.