Uncaught TypeError: $.post is not a function

后端 未结 2 1518
北海茫月
北海茫月 2020-12-03 06:42

I am getting this error in Console:

Uncaught TypeError: $.post is not a function

for this piece of code:



        
相关标签:
2条回答
  • 2020-12-03 06:51

    If you use jquery slim version then this problem will occur. use minified or uncompressed version of jquery js file

    0 讨论(0)
  • 2020-12-03 06:54

    You are using the slim version of jQuery, which doesn't include the Ajax methods (in your case $.post()).

    Use the non-slim build, available here http://jquery.com/download/, such as:

    https://code.jquery.com/jquery-3.5.1.min.js


    From jQuery 3.0 release post:

    Slim build

    [...] Sometimes you don’t need ajax, or you prefer to use one of the many standalone libraries that focus on ajax requests.[...] Along with the regular version of jQuery that includes the ajax and effects modules, we’re releasing a “slim” version [...], it excludes ajax, effects, and currently deprecated code.

    0 讨论(0)
提交回复
热议问题