duplicateCachedPage delete wrong page if using REST principles #1537
Description
Hi there folks,
if using REST, (i'm using rails here) - when for example, you want to work with a database of patients
http://localhost/patients/ - GET retrieves a list of all the patients, BUT
http://localhost/patients/ - POST creates a new record of the patients.
this creates some confusion on the pages due to duplicateCachedPage - lets say - you want to return a page that shows the particular created record after form submission, then jquerymobile deletes the wrong page and returns another in its stead (with the wrong data-url). if no data-url is defined on the returned page, it then gets the url we submitted it to (which in this case is /patients/) thereby ruining the meaning of the page (in this particular use case).
Of course the returned page after form submission can be handled by defining data-url on it, but the page with the list of patients is still removed due to duplicateCachedPage. On mobile view this may seem to not be a problem, since the deleted page will then be reloaded again when requested, but in splitview it simply clears an entire panel - breaking it.
my suggestion is, if a data-url is defined on the returned page (the one returned after form submission) - which jquerymobile is checking for when doing an ajax request - then we need to clear duplicateCachedPage because it means that the url requested is not the url returned, thus it is not a page refresh.
NOTE - the ajax request I'm talking about is in line 570 of jquery.mobile.navigation.js