run function after get API ends
creatediv.html creates new <p> into "newdiv". but output is always 0
$.get('creatediv.html', function(data)
{
$('#newdiv').append(data);}, 'html');
alert($('p').length);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
if write like this output is 1:
$.get('creatediv.html', function(data)
{
$('#newdiv').append(data);}, 'html');
setTimeout("plength();",1000);
function plength()
{
alert($('p').length);
}
how can get output as 1 if i want to write without setTimeout?