I am using ajax with laravel and when I clicked save button. I am getting this error in Console:

TypeError: $.POST is not a function

This is piece of code:

$("form").submit(function (event) event.preventDefault(); name = $("#name").val(); address = $("#address").val(); country = $("#country").val(); $.POST(" route("peoples.store") ", name:name, address:address, country:country, function (data) $("#name").val(""); $("#address").val(""); $("#country").val(""); console.log(data); var tr = ""+ ""+data.id+""+ ""+data.data.name+""+ ""+data.data.address+""+ ""+data.data.country+""+ ""+ "Edit"+ "Delete"+ ""+ ""; $("#data").append(tr); ); );


You are watching: $.post is not a function

*

I"m assuming that you are using JQuery? If so, then the correct method is:

$.post();JavaScript is case sensitive.


*

I think You are using the slim version of jQuery, which doesn"t have AJAX $.post function, can you try that:

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


*

Thanks for contributing an answer to Stack Overflow!

Please be sure to answer the question. Provide details and share your research!

But avoid

Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.


Post Your Answer Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy


Why does my JavaScript code receive a "No 'Access-Control-Allow-Origin' header is present on the requested resource" error, while Postman does not?
*

site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev2021.9.24.40305




See more: Iron Ranger Vs Beckman Vs Wolverine 1000 Mile Vs Red Wing Iron Ranger Vs

Stack Overflow works best with JavaScript enabled
*

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.