Reputation: 83
Currently I am using an Ajax call to load a handlebar template from my local webserver into the application.
$.ajax({
url: "http://localhost/myTemplate.html",
cache: true,
success: function (data) {
template = Handlebars.compile(data);
$('#anyID').append(template);
}
});
Chrome on the Desktop does it fine, in contrast to my Android phone.
Is there a way to load the template correctly using PhoneGap?
Thanks a lot.
Upvotes: 0
Views: 189
Reputation: 26400
You're calling an absolute URL (http://localhost/
). It works fine on your desktop, because it happens to be also your localhost, by chance.
But your phone is not your localhost. There is no web server running on your phone, so no localhost.
Use relative paths like url : "myTemplate.html"
Upvotes: 1