Php 将Post var发送到Jquery modale弹出窗口

Php 将Post var发送到Jquery modale弹出窗口,php,jquery,html,Php,Jquery,Html,我是Jquery的初学者,我试着做一些简单的例子来练习, 在本例中,我试图将POST var从php表单发送到我在internet上找到的jQueryModale弹出窗口 我的问题是,当我点击提交链接发送我的php表单时,我无法将表单变量发送到我的modale弹出窗口 弹出窗口在我的$name中不带var 这是我的密码: : 我想我必须将提交条件添加到我的script.js中,因为当我单击我的链接Jquery时,只选择href,但他不提交表单 有什么想法吗??: 谢谢你 看起来,试图发送表单但您

我是Jquery的初学者,我试着做一些简单的例子来练习, 在本例中,我试图将POST var从php表单发送到我在internet上找到的jQueryModale弹出窗口

我的问题是,当我点击提交链接发送我的php表单时,我无法将表单变量发送到我的modale弹出窗口

弹出窗口在我的$name中不带var

这是我的密码:

:

我想我必须将提交条件添加到我的script.js中,因为当我单击我的链接Jquery时,只选择href,但他不提交表单

有什么想法吗??:


谢谢你

看起来,试图发送表单但您没有提交表单,并且您试图在recep.php上获取的值位于无法发送的锚上!此外,input和anchor的名称都为=nom。单击定位点时还调用了两个函数。所以有很多事情你想分开

首先,您应该决定是使用jQuery、javascript还是两者来调用所需的函数。 如果您使用的是Jquery,则需要一种在页面加载时使用

$('.whateverClass').click(function() { etc });
在本例中,我将使用class或id属性。 如果您使用onclick,您将调用一个javascript函数。在这种情况下,您应该以数组的形式传递所有需要的参数

onclick="callTheFunction(this , '{put an array here with what you want?}')"
因此,该锚定将位于表单的底部,但不会成为表单的一部分。没关系,因为你不想提交表格。。。您希望从表单获取所有PAR,然后使用jQuery或javascript hhtp post/get请求将值ajax到服务器

既然您想使用jQuery,请执行以下操作

<input type="text" name="nameField" id="nameInput" /> <br>
<a href="#?w=500" rel="popup_name" id="popLight">test</a> <br>

<script>
$(document).ready(function() {

    $('.popLight').click(function() {

        //Get the form input value
        var nameInput = $('#nameInput').val(); 

        //Get the anchor attributes
        var href = $('#popLight').attr('href');

        //Do your stuff with the attr parameters, if you really need this here
        //...

        //Send your stuff to the server
        $.post("recep.php", { pars: "Your pars here"},
               function(receivedData) {
               //open whatever you want with the html from the server
                $('#whateverId').html('receivedData');
        });
    });
});
</script>
要使用表单检索值,只需标识表单并从函数中调用它
var$input=$“form:input”.val

看起来,试图发送表单但您没有提交表单,并且您试图在recep.php上获取的值位于无法发送的锚上!此外,input和anchor的名称都为=nom。单击定位点时还调用了两个函数。所以有很多事情你想分开

首先,您应该决定是使用jQuery、javascript还是两者来调用所需的函数。 如果您使用的是Jquery,则需要一种在页面加载时使用

$('.whateverClass').click(function() { etc });
在本例中,我将使用class或id属性。 如果您使用onclick,您将调用一个javascript函数。在这种情况下,您应该以数组的形式传递所有需要的参数

onclick="callTheFunction(this , '{put an array here with what you want?}')"
因此,该锚定将位于表单的底部,但不会成为表单的一部分。没关系,因为你不想提交表格。。。您希望从表单获取所有PAR,然后使用jQuery或javascript hhtp post/get请求将值ajax到服务器

既然您想使用jQuery,请执行以下操作

<input type="text" name="nameField" id="nameInput" /> <br>
<a href="#?w=500" rel="popup_name" id="popLight">test</a> <br>

<script>
$(document).ready(function() {

    $('.popLight').click(function() {

        //Get the form input value
        var nameInput = $('#nameInput').val(); 

        //Get the anchor attributes
        var href = $('#popLight').attr('href');

        //Do your stuff with the attr parameters, if you really need this here
        //...

        //Send your stuff to the server
        $.post("recep.php", { pars: "Your pars here"},
               function(receivedData) {
               //open whatever you want with the html from the server
                $('#whateverId').html('receivedData');
        });
    });
});
</script>
要使用表单检索值,只需标识表单并从函数中调用它
var$input=$“form:input”.val

请在问题中包含您的代码Hi andres,我找不到为什么在这里包含我的代码的方法,这就是我插入这两个链接的原因,很抱歉缺少php代码:非常感谢!!请在问题中包含您的代码Hi andres,我找不到为什么在这里包含我的代码的方法,这就是我插入这两个链接的原因,很抱歉缺少php代码:非常感谢!!