Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing formal parameter

Im trying to load a page when someone is clicking on a button, but In my console already it prints:

missing formal paramter script.js:2:6

$(document).ready({
$("[data-action='openModal']").on("click", function(evt) {
    evt.preventDefault();

    var $object = $(this);

    $.ajax($object.attr("href"), {
       success: function(data) {
           $("body").append(data);
       }
    });
});
});

Im using https://code.jquery.com/jquery-3.2.1.slim.min.js

like image 716
Nightloewe Avatar asked Aug 05 '26 03:08

Nightloewe


1 Answers

You missing "function" in `$(document).ready. When document is ready it calls callback function with your code inside.

$(document).ready(function(){
     //Your code here
});
like image 122
freethinker Avatar answered Aug 06 '26 18:08

freethinker