The first contains a listview of element loaded dinamically by a json.
When a list item is clicked, I have to show the second page with another listview, with the items related to che clicked item.
I'm able to create correctly the view, but when I click the back button and choose another item, the second page also contains the items of the old page.
I've tried to use $("#list").empty(); but when i load the second page for the second time, jquerymobile doesn't load the css correctly.
How can I correct this bug?
Another question.
If I create another file.html for the second page and I use the method
$.mobile.changePage( file.html, {
data: data,
transition: "slide",
changeHash: true,
reloadPage: true
});
And in the file.html I initialize the contens in the method
$( document ).bind( "pageload", function( event, data )
when I click the back button and choose another item, I've the same problem, and are loaded the contents for the old view and the new view.
The form is correctly sent and i'm able to load the page "pages/home/index.html" on success, but the problem is that if in the new page I click the back button, when I resend the form it doesn't perform because take the link of php page starting from "pages/home/", so doesn't found the page.
In the second page, the back button is implemented as:
$("#backButton").click(function() {
setCookie("username", null);
window.localStorage.setItem('userData', null);
$.mobile.changePage( "../../index.html", {
transition: "slide",
reverse: true,
changeHash:true,
reloadPage:true
});
in the $(document).bind('pageload', function (evt,data)
How can I correct this?
And another question, in the new page (pages/home/index.html), where should I put the initializations of the buttons of this page?