I need to load the contents of a div residing on a page inside my website into a div that is shown in Fancybox. Basically, I'm loading a reservation form into a div and showing the whole thing with fancybox. I can't use the .load() function because it strips out all the script tags that validate the form, etc. I'm trying to use the .ajax() function to grab all the html including script tags and other jquery references.
Here's a snipit of what I'm working with:
$.ajax({
url: eventUrl,
dataType: 'html',
success: function(data) {
var include = $(data).filter($('#bookingFormWrapper'))
alert(inclu开发者_运维知识库de);
}
});
The Ajax call here is using a variable to get the url of the page where the detail lives. I need to add the contents of #bookingFormWrapper to a div called #detailView. I'm using alert for testing purposes only. I can't seem to grab just the contents of #bookingFormWrapper. Any help is appreciated!
it's easier if you use .load, like ...
$("#detailview").load(eventUrl + " #bookingFormWrapper")
Have you tried $('#bookingFormWrapper').innerHtml()
or $('#bookingFormWrapper').html()
?
精彩评论