I am developing a mobile app with HTML/JS/PHP, and I'm using flex StageWebView for app host. I'm using Ajax for "More Posts..." Button that trying to load more posts without refreshing page, but it does not work in flex StageWebView,and i show StageWebView After The Page Loaded Compeletly.
in Browsers and Android webView it works fine. any ideas?
JS:
function loadFeed(start, filter) {
$('#more_messages').html('<div class="load_more"><div class="preloader-retina-large preloader-center"></div></div>');
if(filter == '') {
q = '';
} else {
q = '&filter='+filter;
}
$.ajax({
type: "POST",
url: "requests/load_feed.php",
data: "start="+start+q,
cache: false,
success: function(html) {
$('#more_messages').remove();
// Append the new comment to the div id
$('#messages').append(html);
// Reload the timeago plugin
jQuery("div.timeago").timeago();
autosize();
}
});
}
Flex:
protected function addedToStageHandler(event:Event):void
{
webView = new StageWebView();
webView.addEventListener(Event.COMPLETE,onWebViewComplete);
webView.addEventListener(ErrorEvent.ERROR,onWebViewError);
webView.addEventListener(LocationChangeEvent.LOCATION_CHANGE,onWebViewLocationChange);
webView.addEventListener(LocationChangeEvent.LOCATION_CHANGING,onWebViewLocationChanging);
webView.viewPort = new Rectangle(0,0,stage.stageWidth,stage.stageHeight);
trace(webView.location);
webView.loadURL("URL");
}
protected function onWebViewComplete(event:Event):void
{
trace("Complete!");
webView.stage = this.stage;
}