This is really frustrating ..!
When working with jQuery Mobile with predefined pages, everything goes smoothly and easily, but what about more complex projects?
I am working on a survey system that displays the next page based on a previous answer. Therefore, each page should pass the current question to the external API and get the next question.
My first choice was to progress through JS, but the main problem was that the data had to be sent through AJAX, and then the input of the new structured HTML had to be “updated” before doing well. In addition to this, all AJAX requests must have their callbacks that create messy code. So, in my case, a survey containing 20-30 questions, consisting of 15 different types of forms, has a lot of use for callbacks and nested callbacks.
Then I rewrote the project using PHP as a base. forms (containing survey questions) that are sent to the same page with one instance of "data-role = page". With the CURL request, I send the answer and get the next question, generated the HTML structure and voila - it all does great, without having to start the update.
But using this method has its problems:
- sending to the same page deprives you of transitions to the page and you will have a default transition.
- jQuery mobile has this weird caching (even after I used each method to disable it)
- data transfer from page to page is complicated - GET - length
limited and POST does not meet my needs, because the actual CURL request had to be sent "param1 = val1 & ..")
So, what is the best way to work with jQuery Mobile when working on a complex and dynamic project?
Thanks,
source share