UPDATE: The code if working I has some css issues.
I'm trying to put ajax data into facebox modal box, I have the following code but facebox modal box is not loading. Looking into firebug ajax is returning the correct data but i do not know how to pass that data to facebox.
$('a[rel*=facebox]').live("click", function() {
var ajaxpostID=$(this).parent().attr("id"); //Get entry ID
$.ajax({
url: 'http://www.someurl.com/ajax/facebox-ajax.php',
type: "POST",
data: ({
ajaxpostID: ajaxpostID
}),
success: function(data) {
$.facebox(data);
},
error: function() {
$.facebox('There was an error.');
}
});
});
Something like this worked for me:
//added some id to anchor tag and $('a[id='some_anchor_id']').live("click", function() { var ajaxpostID=$(this).parent().attr("id"); //Get entry ID jQuery.facebox(function() { var form_data = { ajaxpostID: ajaxpostID }; $.ajax({ url: "http://www.someurl.com/ajax/facebox-ajax.php", type: 'POST', data: form_data, success: function(data) { jQuery.facebox(data); }, error: function() { $.facebox('There was an error.'); } ) }); }) })
Hope it works for you