Why do I get this 501 Not Implemented error?

前端 未结 3 1725
眼角桃花
眼角桃花 2020-12-07 02:44

I am performing the following AJAX call:

$(document).ready(function() {

  $.getJSON(\'https://sendgrid.com/api/user.stats.json\',
    {
      \'api_user\':          


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 03:20

    As this is the top Google match for "jQuery 501 (Method not implement)" I thought I'd share what worked for me when experiencing this on the same domain (which is not your problem).

    My problem was that I was not returning valid JSON, I was just returning "1". So to fix this, either:

    • Ensure you return valid JSON, or if you don't require a JSON response,
    • Swap your call to use $.ajax instead of $.getJSON, or
    • If you're already using &.ajax, remove type: "json"

    Hope that helps some people.

提交回复
热议问题