您好我想在加载文档时进行ajax调用。这是代码
script(src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js')
script.
$.ajax({ url: '/labeling/page_refresh',
type: 'GET',
success: function(data){ console.log(data) },
error: function(error) { console.log(error)}
});
这是服务器端
router.get('/labeling/page_refresh', function (req, res, next) {
console.log("refreshed!")
db_label.findLabels((err, labels) => {
if (err) {
return res.sendStatus(500)
}
res.send(labels)
})
})
标记console.logs此
[ { _id: 5a73e852316509492f5e0067, label: 'moo: 00:00:00' },
{ _id: 5a73e85a316509492f5e0068, label: 'poo: 00:00:00' } ]
客户端
h4(class='div-class' id='labels')
我回复没有错误,但数据是我自己的html格式的pug文件!
答案 0 :(得分:2)
if (!emailAdd.equals("") || !pass.equals("") || (!name.eqauls(""){
mAuth.createUserWithEmailAndPassword(emailAdd, pass)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Getting UID of Current User
FirebaseUser current_user = mAuth.getCurrentUser();
String UID = current_user.getUid();
usersDB.child(UID).child("email").setValue(emailAdd);
usersDB.child(UID).child("name").setValue(name);
Toast.makeText(youractivity.this, "Registeration done", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(youractivity.this, "Registeration Failed", Toast.LENGTH_SHORT).show();
}
}
});
}