My problem is the following:
I have many surfaces associated with one unique url. When I move to a particular surface the url has to be fired on realtime (ajax) and the response should be set as the content of the surface.
When I try to do the the above, it actually loads all url and its contents upfront while the app is initialising. This slows down the whole process and is not what I want. I want to load content only when the user is active on that surface.
var ajaxContent = "";
$.ajax({
url: 'ajax/article.php?url='+escape(this.options.url),
async: false,
success: function(data) {
ajaxContent = data;
}
});
this.pageSurface = new Surface({
size: [undefined, undefined],
content: ajaxContent,
classes: ["page"],
properties: {
backgroundColor: '#111111',
fontSize: '16px'
}
});
The above code is in a loop of surfaces.