Level 122
Can't see any error there....
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am new to Laravel, following script is not working, I could not able to find the error. Kinldy support.
Can't see any error there....
Any Error in this code
student.blade.php
<div class="modal fade" id="AddSudentModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Add Student</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="form-group mb-3">
<label for="">Name</label>
<input type="text" name="name" class="name form-control">
</div>
<div class="form-group mb-3">
<label for="">E-mail</label>
<input type="text" name="email" class="email form-control">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary add_student">Save</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.4.min.js" integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script>
$(document).ready(function(){
$(document).on('click','.add_student',function(e){
e.preventDefault();
var data={
'name':$('.name').val(),
'email':$('.email').val(),
}
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
type:"POST",
url:"/students",
data:data,
dataType:"json",
success:function response(){
console.log(response);
}
});
});
});
Please or to participate in this conversation.