0
Iam new to node.js db에서 데이터를 가져 와서 그 반환 값을 Jquery로 보내려고합니다.node.js에서 Jquery로 응답 보내기
exports.signin = function (signupCollection, context) {
var record = utils.httpBody(context.req);
signupCollection.find({ },{email: record.email,password: record.password},function(err, result) {
console.log("result-------"+result) // prints the data correctly
if(!err) return result;
});
}
result
인쇄 올바른 데이터가 내가 원하는 다음 코드 ... 그것은이 내부 JQuery와
var data = {
"email": $('#email').val(),
"password": $('#password').val()
};
$.ajax({
type: "post",
url: "/signIn",
dataType: "json",
data: data,
success: function (data) {
console.log("sign in succesfully!!"); // here i want to getthe result data
console.log("SIGN IN RESPOSEE----"+data);
}
});
에서 제대로
지고 난 결과 데이터가 반환 가져올 수 없습니다 보낸 사람 : js
success: function (data) {
alert("data-------------"+data);
}
yessss ... context.res이 object.how 내가 코드를 수정할 수있는 응답이다 네가 말했듯이? – Psl
http : js : 593 throw 새 TypeError ('첫 번째 인수는 문자열 또는 버퍼 여야 함'); – Psl
'result'는'JSON.stringify()'를 사용하는'Object'처럼 보입니다. – leesei