vendredi 16 juin 2023

how to store form with 1500 plus fields using jquey ajax in laravel

screen shot of previewHow can I store a form with more than 1500 fields in Laravel 5.8?

Controller:

public function store(Request $request)
{
     dd($request->all());
}

View file:

@extends('main')
@section('content')

<form class="add_form" id="add_form" enctype="multipart/form-data">
@csrf
@method('PUT') 
<input type="text" name="text_1" >
.
.
.
.
to 1514 parameters
<button type="button" id="submit" >Submit</button>
</form>

@endsection
@push('scripts')

<script type="text/javascript">
  $(document).ready(function(){
    $("#submit").on("click",function(e){
      e.preventDefault();
      if($("#add_form").valid()){
        $.ajax({
          type:"POST",
          url:"",
          data: new FormData($('#add_form')[0]),
          processData: false,
          contentType:false,

          success: function(data){
            if(data.status==='success'){
                  location.reload();
            }else if(data.status==='error'){
                  location.reload();
            }
          }
        });
      }else{
        e.preventDefault();
      }
    });
  });
</script>

@endsection

In my function, I'm only getting an array of 1000 fields, but in my form there are 1514 fields. How can I handle this?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/vQ0Aepg
via IFTTT

Aucun commentaire:

Enregistrer un commentaire