Tag Archives: JQuery error

[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);
                }
            })

How to Solve jQuery error: Uncaught ReferenceError: $ is not defined

When using jQuery, I found the following error:

Uncaught ReferenceError: $ is not defined (anonymous function)

The reason for this error:

1. The path of the jQuery library file is wrong. Checking whether the file path is correct can usually solve the error.

2. If the path of the library file is correct, the order of loading the jQuery library file in the html may be wrong. If the jQuery library file is loaded at the very beginning, the error can be solved.

about jQuery.js The solution to always reporting errors

1, this method is seen on a post, thought that great god provides methods, his blog: http://blog.csdn.net/a1769075789, but the great god didn’t write anything. sorry
JS package always report an error:
The window – & gt; Preference – & gt; MyEclipse-> Click on the validation

Find JavaScript Validator for JS Files in the table on the right and remove the two checks

Save, close.

2. Mutantan – The great god’s blog also has a solution, but has not tried it