I have REST api on backend. I need to make ajax request to POST some data and I write:
$(function() { 
    $('#createPin').click(function(e) { 
        e.preventDefault();
var urlAjax = "http://www.agroagro.com/test/v1/register";
$.ajax({
type: "POST",
url: urlAjax,
contentType: "application/x-www-form-urlencoded",
data: {
                    name: "Mile3",
                    email: "new1@new.com",
                    password: "face1book"
                },
  crossDomain:true, 
  success: function(data) { console.log(data); },
error: function(data) {console.log(data); },
dataType: 'json',
beforeSend: function (xhr) {
            xhr.setRequestHeader("Access-Control-Allow-Origin", "*");
        },
        headers: {
            'Access-Control-Allow-Origin': '*'
        }
});
}); 
});
but on click I get:
         OPTIONS http://www.agroagro.com/test/v1/register jquery-latest.min.js:4 sendjquery-latest.min.js:4 m.extend.ajaxtest.html:114 (anonymous function)jquery-latest.min.js:3 m.event.dispatchjquery-latest.min.js:3 r.handle
    XMLHttpRequest cannot load http://www.agroagro.com/test/v1/register. Invalid HTTP status code 404
    Object {readyState: 0, getResponseHeader: function, getAllResponseHeaders: function, 
setRequestHeader: function, overrideMimeType: function…}
But when I try to run http://www.agroagro.com/test/v1/register on Chrome Advanced Rest Client extension then all works fine... How and why? What is wrong with my ajax request? 
See IMAGE: https://i.stack.imgur.com/XnZCX.png - as you can see all works great with that extension cross domain.
 
     
    