livinzlife
livinzlife

Reputation: 873

Colorbox with .post() request

I am trying to use open a colorbox after a jquery .post(); request, loading the page that I posted to but I have an issue. I am opening a new instance of the page, which did not receive the posted data.

$.post( "/shop/checkout.php", { shipping: shipping },
  function(data) {
    $.colorbox({top: 50,scrolling:false,preloading:false,href:"/shop/checkout.php"});
  }
);

I have used firebug, and the post is successful with the correct data. However, when I load checkout.php within the colorbox, it is an instance of checkout.php that did not receive the data.

Upvotes: 0

Views: 4470

Answers (1)

ShankarSangoli
ShankarSangoli

Reputation: 69905

You already have the data in post callback, just provide the data to colorbox using html option. You don't have to set href option.

$.post( "/shop/checkout.php", { shipping: shipping },
  function(data) {
     $.colorbox({ 
         top: 50,
         scrolling: false,
         preloading: false,
         html: data
     });
  }
);

Upvotes: 8

Related Questions