0

我有一个允许用于编辑表格行的 ajax 表单。一旦提交表单并收到响应,表格中的值就会更新。它在 chrome 中运行良好,但由于某种原因,这些值在 IOS 中没有更新(除非我刷新页面)。我在 StackOverflow 上读到您需要添加cache:false到我所做的代码中,但问题仍然存在。有什么想法我错了吗?

$(document).on("click", ".myBtn", function(){
      var id = $(this).attr("data-id")
      var form = $("#edit_newcredit");

 $.ajax( {
      type: "POST",
      url: form.attr( 'action'),
      data: form.serialize(),
      dataType : "html",
      contentType: "application/x-www-form-urlencoded; charset=UTF-8",
      cache: false,
      headers: { "cache-control": "no-cache" },
      success: function( response ) {
        console.log( response );

      $("#"+id).closest('tr').next('tr').remove(); //Remove the next tr
      $("#"+id).closest('tr').replaceWith(response); //Replace the current tr

      },        
  });
});
4

0 回答 0