[Vuejs]-VUEJS TypeError: $.ajax(…).success is not a function

0👍

It looks to me like there is no success function defined. Just bear in mind that jquery does not use promises, meaning you can not do .then/.catch

0👍

Your code is correct there is no problem with it but with jQuery’s recent update, .success() method is no longer allowed so the code below will emit an error.

$.ajax(url).success

For newer version of jquery, you can do:

$.ajax(url, {
  success: () => {
    // Do something
  }
})

Or

$.ajax({
  type: "GET",
  url,
  success: function () { 
    // Do something
  }
})

Or, you can simple use chain method like so:

$.ajax(url).then(x => {
  // Do something
})

Or

$.ajax(url).done(x => {
  // Do something
})

0👍

There is no function ajax().success.
You Can use something like this :

$.ajax({
      url: "getvalue.php",  
      success: function(data) {
         return data; 
      }
   });
   

Leave a comment