0

首先感谢它,我搜索了很多模态形式,你的似乎更容易使用和修改

我唯一的问题是,如何使用您下载的联系表单版本从调用模态表单和模态表单本身的页面发送动态变量?

当您浏览 js 文件 (contact.js) 以显示模式时,直接获取链接我如何发送一个 var ?

对不起我的英语不好,提前谢谢

朱利安

4

2 回答 2

0

你可以尝试这样的事情:

$(document).ready(function(){
        $("form#contact").submit(function(){

        var str = $("form#contact").serialize();

                           $.ajax({
                           type: "POST",
                           url: "contact.php",
                           data: str,
                           success: function(msg){

        $("#note").ajaxComplete(function(event, request, settings){
        $("#note").show();
        if(msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
        {
        result = '<span class="notification_ok">Your message has been sent. Thank you!</span>';
        $("#fields").hide();
        }
        else
        {
            result = msg;   

        }

        $(this).html(result);

        });

        }
                         });

        return false;

        });

    });

您可以将此表单包含在您的页面中,首先将其隐藏,然后在某些操作后将其带到屏幕中间并提交,如果这是您想要的..

于 2010-02-10T09:53:10.313 回答
0

另一种选择是在点击处理程序中获取变量,然后将它们传递给contact.php 页面。例如:

$('#contact-form input.contact, #contact-form a.contact').click(function (e) {
    e.preventDefault();

    var data = 'foo'; // GET VARIABLES HERE

    // load the contact form using ajax
    $.get("data/contact.php?data=" + data, function(data){

然后在您的contact.php 页面中,您需要获取数据以供使用。

于 2010-02-13T16:26:04.857 回答