[Solved] Cannot read properties of undefined (reading ‘ajax‘); Cannot read property ‘ajax‘ of undefined

Cannot read properties of undefined (reading ‘ajax‘); Cannot read property ‘ajax‘ of undefined

Sending requests using ajax in jQuery. it report an error: Cannot read properties of undefined (reading 'ajax'); Cannot read property 'ajax' of undefined

Codes that report an error:

            $.ajax({
                type:"POST",
                url:"pageServlet",
                data:jsonData,
                dataType:"json",
                success:function (data) {
                    alert(data);
                }
            })

Solution: Change $ to jQuery

            jQuery.ajax({
                type:"POST",
                url:"pageServlet",
                data:jsonData,
                dataType:"json",
                success:function (data) {
                    alert(data);
                }
            })

Read More: