I am using mean to build a website. But when testing, it occurs a problem
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. ------ jquery.js:9425
But I did not use XMLHttpRequest in my project. And the get request(see below) I make has no response, the server even only log the first console.log. I dong't know wether they are related. Thanks.
router.get('/login', function (req, res, next){
User.find({email: req.query.email}, function (err, user){
console.log(req.query.email);
if (err) {
return next(err);
} else if (!user) {
return res.json({message: 'This email is not registered yet.'});
} else {
if (req.query.password != user.password) {
return res.json({message: 'Password is not correct!'});
} else {
console.log(req.query.email);
console.log(user);
console.log(user.username);
var token = auth.signToken(user._id, user.username, user.role);
console.log(token);
res.json({token: token, user: user});
};
};
});
});
In jquery.js file, there is an ajax.settings in jquery.extend(), and in ajax.settings, the async was set to false, just change it to true, and the problem will be resolved.