weixin_33695450 2019-03-13 19:38 采纳率: 0%
浏览 33

调用Ajax后刷新页面

I have two pages, on the first page you can select an item with a <select> </select>. When you select an item, a form is automatically displayed through an AJAX Call. In this form, data is automatically loaded from a mysql db in a <textarea> </textarea>. The moment you submit your form, I want the new data to be added to the <textarea> </textarea> I just can't manage this, who can help me?

$(document).ready(function () {
        $("#btnAdd").click(function (e) {
            /* Retrieving value from textboxes */
        var besproken = $('#besproken').val();  
            $.post("save.php", { 
              besproken: besproken, 
          }, function (data) {
          $("#autoSave").html("Coaching ");
          $("#btnAdd").attr("disabled", true);
          });
            return false;
        });
    });
  • 写回答

2条回答 默认 最新

  • weixin_33726943 2019-03-13 19:51
    关注

    If all you want to do is insert the data into the textarea just use jQuery to selected the element $("textarea") then call the text method and pass in your data .text(data). The result call will look like $("textarea").text(data)

    $(document).ready(function() {
      $("#btnAdd").click(function(e) {
        /* Retrieving value from textboxes */
        var besproken = $('#besproken').val();
        $.post("save.php", {
          besproken: besproken,
        }, function(data) {
          $("#autoSave").html("Coaching ");
          $("#btnAdd").attr("disabled", true);
          $("textarea").text(data);
        });
        return false;
      });
    });
    
    评论

报告相同问题?

悬赏问题

  • ¥15 部分客户订单定位有误的问题
  • ¥15 如何在maya程序中利用python编写领子和褶裥的模型的方法
  • ¥15 Linux权限管理相关操作(求解答)
  • ¥15 Bug traq 数据包 大概什么价
  • ¥15 在anaconda上pytorch和paddle paddle下载报错
  • ¥25 自动填写QQ腾讯文档收集表
  • ¥15 DbVisualizer Pro 12.0.7 sql commander光标错位 显示位置与实际不符
  • ¥15 android 打包报错
  • ¥15 关于stm32的问题
  • ¥15 ncode振动疲劳分析中,noisefloor如何影响PSD函数?