开发者

Colorbox - how to set data property to use POST instead of GET

开发者 https://www.devze.com 2023-03-15 17:28 出处:网络
I\'m using the colorbox plugin and according to the docs, the data property allows submitting GET or POST values through an ajax request. I can submit my data via GET no problem, but can\'t figure out

I'm using the colorbox plugin and according to the docs, the data property allows submitting GET or POST values through an ajax request. I can submit my data via GET no problem, but can't figure out how to switch to POST. I'm using serialize to set the form data in name/value pairs. I have the code below:

开发者_运维百科

Is there a way to set this to POST?

var data = $('form').serialize();

            console.log(data);

            // Preview newsletter - bind colorbox to event
            $('a#preview').colorbox({
                width: '670px',
                href: $(this).attr('href'),
                data: data
            });

            return false;
        });


Use

 $('form').serializeArray();


The data property will act exactly like jQuery's .load() data argument, as ColorBox uses .load() for ajax handling.

0

精彩评论

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