如何将值发送到弹出窗口

时间:2022-05-19 22:10:29

How to do this!? : when click on Add open popup windows with 1.php content then when click on Send generate variable and send this variable and replace content 1.php with 2.php

这该怎么做!? :当点击添加打开弹出窗口的1.php内容时,然后单击发送生成变量并发送此变量并将内容1.php替换为2.php

如何将值发送到弹出窗口

1 个解决方案

#1


0  

Two separate click functions, two separate ajax calls. Going on the basis you have an idea of how to create a popup, the following would be the ebb and flow.

两个单独的单击函数,两个单独的ajax调用。在你了解如何创建弹出窗口的基础上,以下将是潮起潮落。

$('#add').click(function(e){
    e.preventDefault(); 
    $.ajax({
        url: '1.php',
        type: 'get',
        data: {q : 6} //or $('#someEle').text() for dynamic values of course.
    }).done(function(data){
        $('#txtHint').html(data);
        $('#popup').show();
    });
});

//since 'send' seems to be dynamically injected, we need an event handler.

$('#txtHint').on('click', '#send', function(e){
   e.preventDefault();
   $.ajax({
        url: '2.php',
        type: 'get',
        data: {q : 6}
    }).done(function(data){
        $('#txtHint').html(data);
        //popup is already open, no reason to fire .show() again.
    });
});

#1


0  

Two separate click functions, two separate ajax calls. Going on the basis you have an idea of how to create a popup, the following would be the ebb and flow.

两个单独的单击函数,两个单独的ajax调用。在你了解如何创建弹出窗口的基础上,以下将是潮起潮落。

$('#add').click(function(e){
    e.preventDefault(); 
    $.ajax({
        url: '1.php',
        type: 'get',
        data: {q : 6} //or $('#someEle').text() for dynamic values of course.
    }).done(function(data){
        $('#txtHint').html(data);
        $('#popup').show();
    });
});

//since 'send' seems to be dynamically injected, we need an event handler.

$('#txtHint').on('click', '#send', function(e){
   e.preventDefault();
   $.ajax({
        url: '2.php',
        type: 'get',
        data: {q : 6}
    }).done(function(data){
        $('#txtHint').html(data);
        //popup is already open, no reason to fire .show() again.
    });
});