1

i have 2 text node and 1 jquery object, i want append them into DOM, when i do this:

$('<div>')
.append("Ajax Failed, ")
.append($("<span>").addClass('counter').countDown({
    start:o.time,
         onEnd:function(){$.ajax(o.ajax);},
         onRetryEnd:function(){o.onFailed();}
 }))
 .append(" Seconds until resend request")
 .appendTo('#domElement').align({position:'absolute',parent:$('#domElement')});

it will prefect (Result: Ajax Failed, 6 Seconds until resend request), but i want append all this data at once, like:

 var counter = $("<span>").addClass('counter').countDown({
    start:o.time,
         onEnd:function(){$.ajax(o.ajax);},
         onRetryEnd:function(){o.onFailed();}
 });

 $('<div>').append('Ajax Failed, ' + counter + 'Seconds until resend request');

Result: Ajax Failed, [object object] Seconds until resend request.
is possible do it at once and how?

1 Answer 1

3

That is happening because of the plus signs in the last line. Something like:

 $('<div>').append('Ajax Failed, ', counter, 'Seconds until resend request');

Should work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.