Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Console Error with Ajax: ReferenceError: $ is not defined

i have a problem with a little script on my html page. It's just a function which should be called by an onclick method in an a tag. It dont works. Everytime i click on the link in the browser the console says "ReferenceError: $ is not defined" and points on the third line of the code below.

<script>
    function del(urlToDelete) {
        $.ajax({
            url: urlToDelete,
            type: 'DELETE',
            success: function(results) {
                location.reload();
            }
        });
    }
</script>
like image 416
moritz.muecke Avatar asked Oct 09 '14 08:10

moritz.muecke


1 Answers

You need to include jquery library for that.Like this. You need to include this 1st, then write $.ajax to execute.

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

like image 95
Arindam Nayak Avatar answered Sep 21 '22 15:09

Arindam Nayak