Question: I have this string where I need to extract only one word to put into a new columns.

```
HELLO WORLD TEST SHOES1 PROJECT

```

The required string is SHOES, but it has '1' beside it.

How can I extract the SHOES only?

Thank you

Answer: 
```
$("#franchise").change(function() {
    //alert( $( "#franchise" ).val() );
    var f = $( "#franchise" ).val();
    $.ajaxSetup({
      headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
      }
    });
    $.ajax({
      type: 'POST',
      url  : 'ajax/series',
      data : ({franchise : f}),
      dataType: 'JSON',
      success: function(response) {
        $("#series").html('');
        $("#series").append(response);
      }
    });
});

```
just move your below code in document ready function

```
$.ajaxSetup({
      headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
      }
});

```

add `{{ csrf_field() }}` in your common layout file

make sure your js code is in the same file not external js then use below js code

```
$("#franchise").change(function() {
    //alert( $( "#franchise" ).val() );
    var f = $( "#franchise" ).val();
    $.ajax({
      type: 'POST',
      url  : "{{ route('ajax.series') }}",
      data : ({franchise : f}),
      dataType: 'JSON',
      success: function(response) {
        $("#series").html('');
        $("#series").append(response);
      }
    });
});

```