I want to wrap content retrieved with load in jQuery, but I am not sure of the correct syntax, or possibly it's not possible to combine the two this way.
This is throwing an Uncaught TypeError:
$('video').wrap(function(){
$.load('videohold开发者_StackOverflow社区er.php');
});
You need to execute the wrap in a callback (after the AJAX response comes back).
See: JQuery .load() callback function
No, that's not the correct syntax.
$('video').load('videoholder.php')
What Diodeus said. Try this:
$.load('videoholder.php', function(response, status, xhr) {
$('video').wrap(response);
})
Use the callback in the load function and wrap the returned data.
Some rough code below.
$.load('videoholder.php', function( data ){
$('video').wrap( data );
})
;
精彩评论