How to Use Jquery Smart Wizard with some ajax pages

624 views Asked by At

I am having difficulty in understanding how to use the jQuery smart wizard.

I have managed to get it going with static html for my first three tabs but I now want to add another tab which uses an ajax call to get the data based on the data I have collected in the previous tabs.

I know there are callback functions for leaving and entering steps but the documentation is unclear on how to use them (or it maybe I don't understand enough jQuery/JavaScript to correctly interpret the documentation)

The way I read it is I would use

$("#smartwizard").on("stepContent", function(e, anchorObject, stepIndex, stepDirection) {
   // if this is the correct step index then
   // do my ajax call using a promise 
   // (Which I do not understand fully how to do. 
   // I have never used a promise before.)
   // and return my html. (Where is the html going to be put? is it the 'tabpanel'?)
   return myHTMLfromtheajaxcall;
  // else do nothing
  // How do I stop it overriding the existing content?
  // Do I return '' or false or what?
});

What and where do the parameters for the function come from. What is 'e'? What is 'anchorObject'? The other parameters are self explanatory.

I hope somebody can explain things in simple terms with some examples.

Thank you in advance.

0

There are 0 answers