Monaca Onsen UI Discord Chat Github Repo

ons-splitter: calling a link instead of local html file

  • Hi,

    I have an ons-splitter page. Loading the menu with fn.load function.
    It works fine for the local html file.

    But If I call an link, I get the below error.

    onsenui.min.js:2 Uncaught (in promise) Error: "html" must be one wrapper element.
        at Object.util.createElement (onsenui.min.js:2)
        at onsenui.min.js:4
        at <anonymous>

    my code:


        window.fn = {}; = function() {
          var menu = document.getElementById('menu');
        window.fn.load = function(page) {
          var content = document.getElementById('content');
          var menu = document.getElementById('menu');


        <ons-splitter-side id="menu" side="left" width="220px" collapse swipeable>
              <ons-list-item onclick="fn.load('showit.html')" tappable>
                Search Customer
              <ons-list-item onclick="fn.load('/xyz/abc.php?user=Y')" tappable>
                Add New Customer

    Thanks for your help!

  • @mmike Instead of calling fn.load, you need to do: window.location.href = '/xyz/abc/php?user=Y';

  • Ok. Thanks !