Schwad / PorkCasts-Montana

http://www.porkcast.com/
0 stars 0 forks source link

Banal Integration "PUT" failing #43

Open Schwad opened 8 years ago

Schwad commented 8 years ago

error:

XMLHttpRequest cannot load http://simple-track.r15.railsrumble.com/api/events. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.porkcast.com' is therefore not allowed access. The response had HTTP status code 404.

Code in queries#show view:

<!-- Banal Integration -->
<% if @query.created_at.to_date == Date.today && Rails.env != "development" %>
  <%= hidden_field_tag('user_email', current_user.email) %>
  <%= hidden_field_tag('user_query', @query.content) %>

  <script>
    function loadajax(){
      $.ajax("http://simple-track.r15.railsrumble.com/api/events", {
        method: "PUT",
        data: {
          actor: '{ "name": ' + $('#user_email').val() + ' }',
          verb: "created query",
          object: '{ "name": ' + $('#user_query').val() + ', "type": "query" }',
          target: '{ "name": "show page" }',
        },
        headers: {
          "X-AUTHTOKEN": "rnfljeruyid8wfqu6ks9x5scnnxvy784e0usawwg8oc"
        }
      });
    }
    $(function(){
      setTimeout(loadajax,35000);
    });

  </script>
<% end %>
<!-- End banal Integration -->