In my Jquery, i am using Ajax and getting below error msg.
TypeError: $.ajax(...).done is not a function
[Break On This Error] ).success(function(response) {
I tired using success instead of done. but still getting same msg.
TypeError: $.ajax(...).success is not a function
[Break On This Error] ).success(function(response) { 
sample piece of code is mentioned below:
$(document).ready(function () {
        alert('in get');
        $.ajax({
            data: {
                'contentId': contentId,
                'USER_ID': USER_ID,
                'actionType': 'GETRATING',
                'portletGuid': portletGuid
            },
            type: 'GET',
            url: ajaxRatingServlet,
            cache: false
        }).success(function (response) {
            getUserPreference(response);
        });
                Replace your success with done or use success inside ajax function.
An alternative construct to the success callback option, the .done() method replaces the deprecated jqXHR.success() method.
EG
$(document).ready(function () {
    $.ajax({
        data: {
            'contentId': contentId,
            'USER_ID': USER_ID,
            'actionType': 'GETRATING',
            'portletGuid': portletGuid
        },
        type: 'GET',
        url: ajaxRatingServlet,
        cache: false
    }).done(function (response) {
        console.log(response);
  });
 //or use success inside ajax as other answered
 $(document).ready(function() {
      alert('in get'); 
      $.ajax({ 
       data: { 'contentId':contentId, 'USER_ID':USER_ID, 'actionType':'GETRATING', 'portletGuid':portletGuid },
       type:'GET',
       url:ajaxRatingServlet,
       cache:false,
       success: function(response) { 
            getUserPreference(response);
           }
      });
 }); 
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With