如何使用ajax post和url的大胆弹出窗口?

时间:2013-12-29 08:34:19

标签: php jquery ajax

大家好,有一种方法可以使用带有ajax的大胆弹出窗口,一旦触发了大量的弹出窗口,我将使用它来插入数据。

这是我的代码:

$(function () {

    $('.popup-modal').magnificPopup({

    $.ajax({
    type: "POST",
    url: "insertVote.php",
    data: dataString,
    cache: false,

    success: function(html) {
    parent.html(html);
     }  
}); 

    });
return false;

1 个答案:

答案 0 :(得分:3)

你需要使用回调函数:

$('.popup-modal').magnificPopup({

  callbacks : {

    open : function(){
       $.ajax({
          type: "POST",
          url: "insertVote.php",
          data: dataString,
          cache: false,
          success: function(html) {
             parent.html(html);
          }  
       });
    }
  }
});