开发者

SimpleModal Contact Form

first thanks for it, i searched for a lot of modal forms and yours seems to be the easier to use and modify

My only question is how, using your downloaded Contact form version, send a dynamique var from the page calling the modal form开发者_如何学Python and the modal form in itself ?

As you go through a js file ( contact.js ) to show the modal, that directly take the link how can i send a var with it ?

Sorry for my bad english and thanks in advance

Julien


You can try something like this :

$(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;

        });

    });

You can include this form inside your page, hide it at first then upon some action bring it to the middle of the screen and submit it, if that is what you want ..


The other option is to grab the variable in the click handler and then pass those to the contact.php page. For example:

$('#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){

Then in your contact.php page, you'd need to get the data out to use.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜