开发者

JQuery Colorbox and Forms

I have a form which I want to submit and开发者_如何学Go show in Colorbox.

The form is Mals Ecommerce View Cart.

See: https://www.mals-e.com/tpv.php?tp=4

I want it to Show the Cart contents in a colorbox iframe. Is this possible to do using the FORM method rather than the Link method?


here the best answer..

add this to your submitbutton : id="SearchButton"

then use this:

$(document).ready(function() {
    $("input#SearchButton").colorbox({href: function(){
        var url = $(this).parents('form').attr('action');
        var ser = $(this).parents('form').serialize(); //alert(url+'?'+ser);
        return url+'?'+ser;
    }, innerWidth:920, innerHeight:"86%", iframe:true});
});

test at: http://wwww.xaluan.com or http://wwww.xaluan.com/raovat/


I recently faced this problem, spent some time searching the solution and found this:

$("#submit_button").click(function () { // ATTACH CLICK EVENT TO MYBUTTON
    $.post("/postback.php",        // PERFORM AJAX POST
      $("#info_form").serialize(),      // WITH SERIALIZED DATA OF MYFORM
      function(data){                // DATA NEXT SENT TO COLORBOX
        $.colorbox({
          html:   data,
          open:   true,
          iframe: false            // NO FRAME, JUST DIV CONTAINER?
        });
      },
      "html");
  });

I.e. Colorbox uses submitting the form via standard jQuery methods. Hope this helps someone.


Try

$("input#formsubmit").colorbox({title: function(){
    var url = $(this).parents('form').attr('action');
}});

Not tested, I just took the syntax from the Colorbox page. You'd have to give your submit button an id of "formsubmit" for the above to work.


you can open colorbox independently using:

jQuery.colorbox({href:,iframe:true, opacity:0.6 ,innerWidth:760,innerHeight:420,title:});

and you can call this function on any event like:

jQuery("document").ready(function(){ jQuery.colorbox.. });

when u submit a form send a query parameter along with it. When after submission you reach back the form. see if that parameter is populated.

and then call jQuery.colorbox()

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜