R
ragtek
Guest
I want to replace some code after i recive some data with ajax.
This is my code:
my 2 debugcodes
are showing, that the container is existing [object Object] and the likes value.
BUT the content of $container isn't replaced.
This is my code:
Code:
$link.click(function(e)
{
e.preventDefault();
var $link = $(this);
var oldVotes = $link.data('votes');
var $container = $($link.data('container'));
XenForo.ajax(this.href, {}, function(ajaxData, textStatus)
{
if(ajaxData.likes){
alert($container);
alert(ajaxData.likes);
//$container.innerHTML = '<div>test</div>';
// $container.innerHTML = 'test';
$replace = ajaxData.likes;
$container.xfInsert('insertBefore', $replace);
}
});
});
my 2 debugcodes
Code:
alert($container);
alert(ajaxData.likes);
BUT the content of $container isn't replaced.