Can't link my js file to my pug browser console shows
The script from “http://localhost:3000/script.js” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.
2 signin
Loading failed for the <script> with source “http://localhost:3000/script.js”. signin:1:1
I've tried doing this with script tags but my js code has some errors I guess and I can't see those errors unless the code is in a different file.
this is my pug file
script(type='text/javascript' src="http://code.jquery.com/jquery-latest.js")
script( type= 'text/javascript',src="./script.js")
form( id='formSignIn')
div.form-group
label(for='name') Id:
input#name.form-control(type='text', placeholder='id' name='name')
div.form-group
label(for='pw') Password:
input#password.form-control(type='password', name='password')
button.btn.btn-primary(type='submit', id='submit') Sign In
this is my js file
$(document).ready(function(){
console.log("hi");
var name,password;
// $("#submit").click(function(){
name= $("#name").val();
password=$("#password").val();
console.log("$$$$$$$$$$$$$", name, password)
$.post("/login", {name: name, password: password} ,function(data){
console.log("AJAx");
});
console.log("@@@@@@@@@@@@@@@@@");
localStorage.setItem('user',name);
}