Ajax:如何获得请求?

<p><input type="button" id="ajax" value="click here!"/><br/>
<script type="text/javascript">
  $(function () {
      $('#ajax').click(
          function () {
              $.ajax({
                  type: 'get',
                  url: 'https://example.com',
                  success: function (data) {
                      alert("OKAY");
                  },
                  error: function (data) {
                      alert("NG");
                  }
              });
          });
  });

I want to GET request using Ajax in Rails but sent options request.

This is an error shown console log

OPTIONS https://example.com 405 (Method Not Allowed)