Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/emacs/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php jquery$。从弹出窗口将数据发布到弹出窗口_Php_Jquery_Post - Fatal编程技术网

Php jquery$。从弹出窗口将数据发布到弹出窗口

Php jquery$。从弹出窗口将数据发布到弹出窗口,php,jquery,post,Php,Jquery,Post,我正在尝试从用window.open方法打开的弹出窗口将数据发布到新窗口(使用window.open)。我试图做的是将所选的选项值传递给新打开的窗口,并使用$\u POST加载数据 以下是我尝试过的: $(document).on('click', '.openForm', function() { var select = $(this).data('select'), val = $('#'+ select).val(); $.post('/path/

我正在尝试从用window.open方法打开的弹出窗口将数据发布到新窗口(使用window.open)。我试图做的是将所选的选项值传递给新打开的窗口,并使用$\u POST加载数据

以下是我尝试过的:

$(document).on('click', '.openForm', function()
{
    var select = $(this).data('select'),
        val    = $('#'+ select).val();

    $.post('/path/to/page.php', {id: val}, function(res)
    {
        window.open('/path/to/page.php');
    });
});
目前page.php有一个var_dump$_POST,返回空。它也会在一个新的标签页而不是一个新的窗口中打开页面-我想这是为了给打开的窗口指定唯一的名称

我不知道如何让它如此$。post与张贴到同一页,并打开它与发送的数据-任何链接或解决方案,你知道可以工作


谢谢:)

修改脚本如下:

 <script type="text/javascript">
$(document).on('click', '.openForm', function()
{
    var select = $(this).data('select'),
        val    = $('#'+ select).val();


    $.post('/path/to/page.php', {id: val}, function(res)
    {
        console.log(res);

        var myWindow = window.open("", "MyWindow", "width=600,height=600");
        myWindow.document.write(res);
        //window.open('test_json.php',1,'width=600, height=600');
    });
});

</script>

$(文档).on('click','.openForm',function()
{
var select=$(this).data('select'),
val=$('#'+select).val();
$.post('/path/to/page.php',{id:val},函数(res)
{
控制台日志(res);
var myWindow=window.open(“,”myWindow“,”宽度=600,高度=600”);
myWindow.document.write(res);
//open('test_json.php',1,'width=600,height=600');
});
});
1) $u POST的var\u转储返回空。因为您同时请求
$.post('/path/to/page.php')
window.open('/path/to/page.php')将不同。第一次作为post处理,并在完成后
window.open('/path/to/page.php')将出现,这将是
get
请求


2) 要在同一个非新选项卡上打开窗口,您必须在
window.open()
方法中将其宽度和高度作为第三个参数传递。

修改脚本如下:

 <script type="text/javascript">
$(document).on('click', '.openForm', function()
{
    var select = $(this).data('select'),
        val    = $('#'+ select).val();


    $.post('/path/to/page.php', {id: val}, function(res)
    {
        console.log(res);

        var myWindow = window.open("", "MyWindow", "width=600,height=600");
        myWindow.document.write(res);
        //window.open('test_json.php',1,'width=600, height=600');
    });
});

</script>

$(文档).on('click','.openForm',function()
{
var select=$(this).data('select'),
val=$('#'+select).val();
$.post('/path/to/page.php',{id:val},函数(res)
{
控制台日志(res);
var myWindow=window.open(“,”myWindow“,”宽度=600,高度=600”);
myWindow.document.write(res);
//open('test_json.php',1,'width=600,height=600');
});
});
1) $u POST的var\u转储返回空。因为您同时请求
$.post('/path/to/page.php')
window.open('/path/to/page.php')将不同。第一次作为post处理,并在完成后
window.open('/path/to/page.php')将出现,这将是
get
请求

2) 要在同一个非新选项卡上打开窗口,必须在
window.open()方法中将其宽度和高度作为第三个参数传递