As told in another thread, there is nothing built-in in iUI to fill this kind of app-specific use-case. It has a _replace mechanism to extend a list view, but nothing to replace an element.
function refreshCurrentPage() { iui.ajax("MyAjaxFile.php",null, 'get', function(response) { if (response.readyState == 4) { var currentPage = iui.getSelectedPage(); currentPage.innerHTML = response.responseText; } }); } Note that in this case, MyAjaxFile.php should only contains the page fragment content. You can also give iui.insertPages(fragment) a try: iui.insertPages(frag) If an AJAX call (showPageByHref()) is made without supplying a replace element, insertPages() is called to insert the newly-created element fragment into the page DOM. Each child-node of the HTML fragment is a panel and *if any of them are already in the DOM, they will be replaced by the incoming elements*. Note that in this case, this will replace the whole page, not just its content or a particular part of its content. Remi Remi On Thu, Nov 21, 2013 at 12:06 AM, Sean Gilligan <msgilli...@gmail.com>wrote: > What version of iUI are you using? Do you have a simplified demonstration > (or the full app) available somewhere I can look at it? > > -- Sean > > > > On 11/18/13 12:17 PM, Wayne Bennett wrote: > >> I have built a simple iui webapp which gets data from a mysql db via ajax >> which all works the way it should. I want to refresh the data via a script >> and so need to reload the new ajax data and replace the current page >> fragment with the new data. >> I have tried this: >> >> function refreshCurrentPage() { >> MyAjax = iui.ajax("MyAjaxFile.php",null,null,success); >> } >> >> >> function success(Ajax){ >> if (Ajax.readyState == 4){ >> $('#CurrentPage').replaceWith(Ajax.responseText); >> } >> } >> >> That sort of works except that the selected attribute of the newly loaded >> fragment doesn't exist so I get a blank page. If I set it in my success >> script, voilla, my content appears. The only problem then is that the iui >> navigation gets screwed up. If I click the back button, I end up with two >> page fragments with selected set to true and the href links which worked >> previously, so longer work. >> >> I'm sure there is an easy way to do this and I've probably overlooked it >> in the documentation but I would appreciate any help you could manage. >> >> Thanks >> >> > -- > You received this message because you are subscribed to the Google Groups > "iPhoneWebDev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to iphonewebdev+unsubscr...@googlegroups.com. > To post to this group, send email to iphonewebdev@googlegroups.com. > Visit this group at http://groups.google.com/group/iphonewebdev. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "iPhoneWebDev" group. To unsubscribe from this group and stop receiving emails from it, send an email to iphonewebdev+unsubscr...@googlegroups.com. To post to this group, send email to iphonewebdev@googlegroups.com. Visit this group at http://groups.google.com/group/iphonewebdev. For more options, visit https://groups.google.com/groups/opt_out.