0

我有一个包含 6 个选项卡(Jquery 选项卡)的页面,每个选项卡上都有一个表单。我看起来像一个简单的问题,但我正在打破我的头。我想submit在表单之后更新 div(选项卡) submit,当然还有一些操作(数据库更新)。

<form name="prijzen_huidige_jaar" method="post" action="<?php $_SERVER["PHP_SELF"] ?>">
4

2 回答 2

1

你可以从这样的事情开始:

$(document).ready(function(){
  $('.form-to-submit').submit(function(){ // a class to give all your forms
    content = $(this).serialize();
    $.post('/path/to/script.php', content, function(data){
      if(data){ 
        // The script returned something in the "data" variable. Do things like:
        $('container').replaceWith(data);
      }
    });
  })
});
于 2012-12-15T19:48:41.347 回答
0

您是通过 ajax 获得更改吗?

如果是...您可以使用成功事件进行更改。

$.post(Url , function(data){
}).success(function(data){
  //Here you could do another post call to get your new data 
  $.post(refreshUrl,function(dataRefresh){
     //Your refresh here
  });
});
于 2012-12-15T19:41:54.930 回答