Using the Application object to navigate to various views
When building a mobile application, you will have multiple views representing various states in the application, that is, each state is represented by a View
component in the application. For example, when you click on a button, the current view is disposed and the new view should be displayed. The Application object is used to navigate between various views in the application. These views can be defined in the same HTML document or can be present as a separate document (partials).
How to do it…
A good way to structure the code is to create multiple pages and separate the views. Specifying all the views in the same page will increase the size of the response and, hence, hamper the performance. Let's create a page that contains two buttons, namely, Login and Register:
<div data-role="layout" data-id="layout1"> <header data-role="header"> <div data-role="navbar"> <span data-role="view-title"><...