I have really tried to find an answer to a problem I have run into.
I have an webapp made with jQuery Mobile and PHP. This is how it works.
- Select an item from a listview
- Call function to load data from mysql
- Present the data in another subpage (back button enabled)
- text in a textarea [id=question]
- id in a hidden textbox [id=quizId]
- on/off switch [id=active])
- Edit the data in the subpage and save to the database
- Go back to listView
I have no problem browsing through the listview and subpage and the result shows up OK. The problem comes when I edit the textarea and either saves or just goes back. After that when i enter a new choice the textarea does´nt update via this code
$('#question').load(weblink);
The update of the on/off switch works fine but not the textarea.
(below is an example of the listitems which are populated by php from the database)
<li data-theme="a" onClick="getQuiz(this.id);" id="xxx"><a href="#quizeditor" data-transition="slide">xxx</a></li>
This is the function I call when the listview item is pressed and linking to the subpage to view the content.
function getQuiz(id) {
document.getElementById('quizHeader').innerHTML = 'Quiz: ' + id;
document.getElementById('quizId').value = id;
$.ajax({
typeof: 'POST',
url: 'editorcommands.php?action=loadQuestionStatus&id=' + id,
dataType: 'json',
success: function (responce) {
if (responce === 'on') {
$('#active').val('on');
$('#active').val('on').slider("refresh");
} else {
$('#active').val('off');
$('#active').val('off').slider("refresh");
}
}
});
var weblink = 'editorcommands.php?action=loadQuestion&id=' + id;
$('#question').load(weblink);
}