Button not working in multi-page application

2019-09-11 06:59发布

问题:

I have created 2 buttons. The second button should go to NewFile.html but it isn't working. my index.html main file consist of div tag inside it created 2 buttons and with id ForNext for one of the button.

main.js

var pagesHistory = [];
var currentPage = {};
var path = "";

function wlCommonInit(){
$('#ForDeviceProp').click(deviceProp);
$('#ForNext').click(nextMethod);
}
function nextMethod() {

$("#ForNext").load(path + "pages/NewFile.html", function(){
$.getScript(path + "js/NewPage.js", function() {
          if (currentPage.init) {
            currentPage.init();
         }
    });
});

}

Newpage.js

currentPage = {};
currentPage.init = function(){
WL.Logger.debug("NewFile :: init");
};

回答1:

There are all sort of issues, but the main ones are the following:

  1. In nextMethod() You are trying to load NewFile.html into the ID of your button. That won't work: $("#ForNext").load("pages/NewFile.html", function(){

It needs to be loaded into the pagePort DIV. Replace "ForNext" with "pagePort".

  1. In bba= WL.Client.getEnvironmen();, you are missing the "t" in ".getEnvironment".