我试过:
var second_date = moment(currentdate).format('DD-MM-YYYY');
显示
Uncaught Reference Error: moment is not defined.
success: function(response){
var len = 0;
if(response != null){
len = response.length;
for(var i=0; i<len; i++)
{
var id = response[i].id;
var currentdate = response[i].currentdate;
var name = response[i].name;
}
}
最佳答案
确保您的 cdn 脚本已添加并位于 Jquery cdn
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
然后就可以了
关于javascript - 如何更改ajax成功回调中的日期格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59081893/