I need to pass data from fancybox iframe to my django view using post. I set the iframe title as "a href" link that the user can click on.
this is the code for the fancybox:
$(".fancybox-company").fancybox({
width : '75%',
height : '75%',
autoSize : false,
closeClick : false,
fitToView : false,
openEffect : 'none',
closeEffect : 'none',
type : 'iframe',
beforeLoad: function() {
var id = $(this.element).data('company-id');
this.title = "<a href=\"\" id=company-iframe>Add to your list</a>";
}
});
and this is the code that listens on click events:
$( ".company-iframe" ).on( 'click', function ( event ) {
event.preventDefault();
var id = event.target.href;
$.post( "/company/selection", { id : id }, function ( json ) {
// ...
} );
this is not being called, i need to pass the click event from the iframe to the parent and pass the company id as input.
what am i missing?
10x