callumb
callumb

Reputation: 189

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

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;
        });

Upvotes: 3

Views: 6882

Answers (2)

Vivek Goel
Vivek Goel

Reputation: 24150

Use

 $('form').serializeArray();

Upvotes: 2

Ethem Kuloglu
Ethem Kuloglu

Reputation: 833

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

Upvotes: 0

Related Questions