triggering a page change with code

can anyone tell me how I can code a page change event? I've got some JavaScript already running in an iAd page and I want to add some code that will change the ad to page 2 when a condition is met. In other words:


function(isConfirm){  
             if (isConfirm) { 
                  for (n = 1; n <= TotalQuestions; n++) {
                     localStorage.setItem(Place + "Key" + n, "");
                  }
                 location.reload();
               //go to page 2 here
             } else { // etc...


I have a button to run this code, clear student answers from localStorage by reducing the values to an empty string and then reload the page with blank entries from local Storage. The problem is that I have three pages and when the location is reloaded from, say, page 3, it switches back to page 1 as this is the first view that loads when the widget runs. Anyone know how to tell it to reload the widget but then go to the same page the button is on (i.e. this.viewController)?

iMac, iOS 8.2

Posted on Apr 27, 2015 4:40 AM

Reply

There are no replies.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

triggering a page change with code

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.