dongtu7567 2013-05-26 23:15
浏览 49

Jquery Mobile:编辑textarea后,Ajax .load无法正常工作

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);

}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 RPA正常跑,cmd输入cookies跑不出来
    • ¥15 求帮我调试一下freefem代码
    • ¥15 matlab代码解决,怎么运行
    • ¥15 R语言Rstudio突然无法启动
    • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
    • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。