Performing multiple router framework7 functions back

I am creating an application where a user can submit a form using ajax and the form will be submitted and upon success it will return to the previous page and then load two more pages. Here's a little more information before I move on to the code snippet

I have a list of items and want to add another item. I have a button that will open a form to add items. When I submit a form with AJAX and after success I want:

  • Go back to the list of items in history mainView.router.back()

    to update it with the new item and then
  • Go to the product page mainView.router.loadPage()

    and then
  • Jump to assignment for this item automatically, which is another page mainView.router.loadPage()

I want all three of these actions to be done one after the other. Returning will not allow the user to use the back button and return to a form that has already been submitted, the navigation to the item page will be there unless the user wants to do the default action to run the task for the item.I have successfully tested and can do any ONE of these actions. but can't figure out how to call router functions one by one at the same time at the same time.

...
var item_id = data.newItem.id;
mainView.router.back({
  url: page.view.history[page.view.history.length - 2],
  force: true,
  ignoreCache: true
});
mainView.router.loadPage('http://app.myapp. com/item.php?id='+item_id);
mainView.router.loadPage('http://app.myapp.com/start-item-task.php?id='+item_id);
...

      

+3


source to share





All Articles