I am wanting to add a callback to some code.
Here is the code before hand:
var htmlParent2 = $('#testnohtml');
setHtml("/objects/data.html", htmlParent2);
$('#text', htmlParent2).html("test text");
function setHtml(url, parent)
{
$.get( url, function( data ) {
parent.html( data );
});
}
Here is what I have written:
var htmlParent2 = $('#testnohtml');
setHtml("/objects/data.html", htmlParent2, function(result))
{
$('#text', htmlParent2).html("test text");
}
function setHtml(url, parent, callback)
{
$.get( url, function( data ) {
parent.html( data );
});
}
I am getting the following error:
Uncaught SyntaxError: Unexpected token )
At this line of code:
setHtml("/objects/data.html", htmlParent2, function(result))
Can someone please help me with the correct syntax?
callback()