Nightloewe
Nightloewe

Reputation: 1098

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

Upvotes: 3

Views: 629

Answers (1)

freethinker
freethinker

Reputation: 2425

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

$(document).ready(function(){
     //Your code here
});

Upvotes: 1

Related Questions