Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot read property 'mode' of undefined

Very simple AJAX request, but it's not working at all. Getting this error i've never seen before:

Cannot read property 'mode' of undefined

$.ajax({
    url: '/Contractor/api/plot/LinkBuyer',
    method: 'POST',
    data: {
        'buyerId': 1,
        'plotId' : parseInt(sPlotId, 10),
        'activateDirectly': true
    },
    success: function (data) {
        console.log('success');
    },
    error: function(jqXHR, textStatus, errorThrown) {
        console.log(JSON.stringify(jqXHR));
        console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
    }
});
like image 618
Luc Avatar asked Sep 01 '17 12:09

Luc


People also ask

How do you fix undefined property Cannot be read?

To solve the "Cannot read properties of undefined" error, make sure that the DOM element you are accessing exists. The error is often thrown when trying to access a property at a non-existent index after using the getElementsByClassName() method.

What is Cannot read property of undefined?

What Causes TypeError: Cannot Read Property of Undefined. Undefined means that a variable has been declared but has not been assigned a value. In JavaScript, properties and functions can only belong to objects.

Can not read properties of undefined angular?

To fix Error: TypeError: Cannot read property '…' of undefined with Angular, we should make sure the variable we're rendering is defined. to use the safe navigation operator if foo and bar are objects. We use arr && arr. length > 0 to make sure arr is defined and it has length bigger than 0.

What does Cannot read property of null mean?

The "Cannot read property 'click' of null" error occurs when trying to call the click method on a null value. To solve the error, run the JS script after the DOM elements are available and make sure you only call the method on valid DOM elements.


1 Answers

Got the answer! I was using the slim version of jquery...

like image 174
Luc Avatar answered Sep 29 '22 05:09

Luc