web.php
Route::post('portal/student_exam_info_edit','PortalOperation@student_exam_info_edit');
Controller its my portaloperation controller and i want to show data in request but i show error
public function student_exam_info_edit(Request $request)
{
print_r($request->all());
}
student_exam_info.blade.php
@extends('layouts.portal')
@section('title','Exam Form')
@section('content')
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0 text-dark">Student Exams Info</h1>
</div><!-- /.col -->
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active">Student Exams Info</li>
</ol>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<!-- Default box -->
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-sm-6">
<h3> </h3>
</div>
<div class="col-sm-6">
<h3> <span class="float-right"></span></h3>
</div>
</div>
<form action="" class="database_operation">
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<label>Enter Name</label>
<input type="hidden" name="id" value="">
<input type="text" name="name" required="required" value="" placeholder="Enter Name" class="form-control">
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
<label>Enter E-Mail</label>
<input type="text" required="required" name="email" value="" placeholder="Enter E-Mail" class="form-control">
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
<label>Enter Mobile No</label>
<input type="text" name="mobile_no" value="" placeholder="Enter Mobile No" class="form-control">
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
<label>Select DOB</label>
<input type="date" name="dob" value="" class="form-control">
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
<label>Enter Password</label>
<input type="password" name="password" placeholder="Enter Password" class="form-control">
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
<button class="btn btn-info"> Update</button>
</div>
</div>
</div>
</form>
</div>
<!-- /.card-body -->
<!-- /.card-footer-->
</div>
<!-- /.card -->
</div>
</div>
</div>
</section>
</div>
@endsection
custom.js
$(document).on('submit','.database_operation',function () {
var url=$(this).attr('action');
var data=$(this).serialize();
$.post(url,data,function (fb) {
var resp=$.parseJSON(fb)
if(resp.status=='true')
{
alert(resp.message) ;
setTimeout(function () {
window.location.href = resp.reload;
},1000);
}
else
{
alert(resp.message) ;
}
})
return false;
});
$(document).on('click','.category_status',function () {
var id=$(this).attr('data-id');
$.get(BASE_URL+'/admin/category_status/'+id,function (fb) {
alert('Status Successfully Changed');
})
});
$(document).on('click','.exam_status',function () {
var id=$(this).attr('data-id');
$.get(BASE_URL+'/admin/exam_status/'+id,function (fb) {
alert('Status Successfully Changed');
})
});
$(document).on('click','.student_status',function()
{
var id=$(this).attr('data-id');
$.get(BASE_URL+'/admin/student_status/'+id,function (fb) {
alert('Status Successfully Changed');
})
})
$(document).on('click','.portal_status',function()
{
var id=$(this).attr('data-id');
$.get(BASE_URL+'/admin/portal_status/'+id,function (fb) {
alert('Status Successfully Changed');
})
})
Error When i update form and check inspect element network i cant understand what is this error means how to it solve i find solution couple of hours but cant solve
VM2391:1 Uncaught SyntaxError: Unexpected token A in JSON at position 0
at Function.parse [as parseJSON] (<anonymous>)
at Object.success (custom.js:5)
at c (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at l (jquery.min.js:2)
at XMLHttpRequest.<anonymous> (jquery.min.js:2)
(anonymous) @ custom.js:5
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
l @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
load (async)
send @ jquery.min.js:2
ajax @ jquery.min.js:2
k.<computed> @ jquery.min.js:2
(anonymous) @ custom.js:4
dispatch @ jquery.min.js:2
v.handle @ jquery.min.js:2
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire