Bootstrap 4.5.x for a design - jquery is jquery-3.5.1.slim.min.js can you tell why this gives error

https://api.jquery.com/jquery.ajax/#jQuery-ajax-settings

I choose Bootstrap 4.5.x for a design - jquery is
jquery-3.5.1.slim.min.js
can you tell why this gives error???

webformsPHPajax.js?2020-06-09cc:24 Uncaught TypeError: $.ajax is not a function
at HTMLButtonElement. (webformsPHPajax.js?2020-06-09cc:24)
at HTMLButtonElement.dispatch (jquery-3.5.1.slim.min.js:2)
at HTMLButtonElement.v.handle (jquery-3.5.1.slim.min.js:2)

var url = "php/contactus.php";

$('#send1').click(function(e){

    e.preventDefault();

    e.stopPropagation();

    var jqxhr = $.ajax( {    // line 24

        url: url, 

        type: 'POST',

        data:

        {

        name: escapeHTML($('#name').val()),

        email: escapeHTML($('#email').val()),

        phone: escapeHTML($('#phone').val()),

        comments: escapeHTML($('#comment').val())

        }}).done(function() {

        alert( "success" );

        if (response=="true")                 

            $("#alertMsg").html('<div class="alert alert-success"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a><strong>Success!</strong> We will reply ASAP!!</div>');

        else      

            $("#alertMsg").html('<div class="alert alert-danger"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a><strong>Error!</strong> Something went wrong, check your email and retry!</div>');      

        }

      )

      .fail(function() {

        alert( "error" );

        $("#alertMsg").html('<div class="alert alert-danger"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a><strong>Error!</strong> Something went wrong, check your email and retry!</div>');    

      })

      .always(function() {

        alert( "complete" );

      });

    return false;

});

Well $.ajax() is not part of jQuery slim, if you want to use it you’ll have to include the regular build instead.

2 Likes

now working
loaded

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

2 Likes