1
What problem with my code, on the console shows this error:
home:85 Uncaught TypeError: $.ajax is not a function
at HTMLFormElement.<anonymous> (home:85)
at HTMLFormElement.dispatch (jquery-3.2.1.slim.min.js:3)
at HTMLFormElement.q.handle (jquery-3.2.1.slim.min.js:3)
Researching I found this in Soen:
My code javascript
<script type="text/javascript">
$(function() {
$('#login-form').submit(function(e) {
e.preventDefault(), $('#btn-login').html('Autenticando...');
var username = $('#username').val();
if (/^[a-zA-Z0-9_ ]*$/.test(username)) {
$('.form-message').css('display', 'block'),
$('.message').html('Existem caracteres especiais no seu usuário. Se estiver usando <strong>"@"</strong>, remova-o!');
return false;
}
$.ajax({
type: 'POST',
data: $(this).serialize(),
success: function(s) {
alert('ok');
}
});
});
});
</script>
which version of jquery is using?
– user60252
I got it, mate, thanks. The version is up there,
jquery-3.2.1.slim.min.js
– user76271
Actually it was not the intention but I managed to tidy up and put the answer.
– user76271