我试图将我的MongoDB中的数据显示给我的html。数据在MongoDB中,但它不会在我的html上显示。我的代码:
$(document).ready(function(){
$( "#buttonlogin" ).click(function(){
masuklogin();
});
});
function masuklogin(){
var formdata = {
nomortelp : $("#nomortelp").val(),
password : $("#password").val()
};
var Jformdata = JSON.stringify(formdata);
console.log(Jformdata);
$.ajax({
url : "/Dompetku/BankMasuk",
context : document.body,
}).done(function (response){
console.log(response);
console.log("ini kerja");
var table = "";
table += "<table class = 'table'> ";
table += "<thread>";
table += "<tr>";
table += "<th>" + "Username" +"</th>";
table += "<th>" + "Password" +"</th>";
table += "<tr>";
table += "<thread>";
response.forEach(function(BankSinarmas) {
table += "<tr>";
table += "<th>" + BankSinarmas.nomortelp; +"</th>";
table += "<th>" + BankSinarmas.password; +"</th>";
table += "<tr>";
});
table += "</table>";
$(".initable").html(table);
});
}
我的错误就是这样:
index.js:3 Uncaught ReferenceError: masuk is not defined(anonymous function) @ index.js:3dispatch @ jquery-3.0.0.min.js:5q.handle @ jquery-3.0.0.min.js:5
它是否认为阅读masuklogin()
函数而不是masuk()
函数?
谢谢你,我希望你们能帮助我。