Reputation: 4510
x.html:
<h4> Created: <span id="link-created"></span></h4> --> Date is not printed
Javascript:
var create_date = new Date((data.created)*1000); --> data.created is epoch time
$('#link-created').text(create_date);
Any idea why?
Upvotes: 0
Views: 204
Reputation: 66961
It seems data.created must not be coming up with a Number...
Everything else is correct otherwise.
Upvotes: 0
Reputation: 2797
jQuery doesn't like you passing a non-string to .text(). Try this instead:
$('#link-created').text(create_date.toString());
Oh, and to confirm that data.created isn't the problem, you can do (as a test):
var create_date = new Date();
Upvotes: 1