I wanted to minify html output so I have used the renatomarinho/laravel-page-speed package. I have done as per the instruction on its github page https://github.com/renatomarinho/laravel-page-speed
. But for some reason now the jquery stopped working after installing this package. I thought this issue was caused due to the comments in javascript file so i have removed all the comments from the js library files that I have included. But still jquery is not working. Please help me out. Please check the attached image.
javascript code
<script src="{{ asset('backend/assets/plugins/global/plugins.bundle.js') }}?v={{ time() }}"></script>
<script src="{{ asset('backend/assets/plugins/custom/prismjs/prismjs.bundle.js') }}?v={{ time() }}"></script>
<script src="{{ asset('backend/assets/js/scripts.bundle.js') }}?v={{ time() }}"></script>
<!--end::Global Theme Bundle-->
<!--begin::Page Scripts(used by this page)-->
<script>
$(document).ready(function(){
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$("#loginform").submit(function(e){
e.preventDefault();
var status=false;
if($(".email").val()==""){
$(".email_error").html("Email address is mandatory");
$(".email_error").show();
status=false;
} else {
$(".email_error").hide();
status=true;
}
if($(".email").val()!==""){
if(validateEmail($(".email").val())==false){
$(".email_error").html("Invalid Email address");
$(".email_error").show();
status=false;
} else {
$(".email_error").hide();
status=true;
}
}
if($(".password").val()==""){
$(".password_error").html("Password is mandatory");
$(".password_error").show();
status=false;
} else {
$(".password_error").hide();
status=true;
}
if(status==true){
var formdata=$("#loginform").serialize();
$.ajax({
url:"{{ route('admin.loginprocess') }}",
type:"post",
async:false,
data:formdata,
success:function(res){
if(res.status=='fail'){
$(".alert-danger").html("Invalid email or password");
$(".alert-danger").removeClass('d-none');
$(".alert-success").addClass('d-none');
}
if(res.status=='success'){
$(".alert-success").html("Login Successful");
$(".alert-success").removeClass('d-none');
$(".alert-danger").addClass('d-none');
setTimeout(function(){ window.location="{{ route('admin.dashboard') }}"; }, 1500);
}
}
});
}
});
});
function validateEmail(email) {
const re = /^(([^<>()[]\.,;:s@"]+(.[^<>()[]\.,;:s@"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());
}
</script>
question from:
https://stackoverflow.com/questions/65841135/jquery-not-working-after-using-renatomarinho-laravel-page-speed-package 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…