No "Access-Control-Allow-Origin" on using POST in ajax request

32 views Asked by At

I am using below code to connect to Titan-cassandra-gremlin server to get the data.Return expression is json format.

It gives No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8383' is therefore not allowed access. The response had HTTP status code 400.

When I use GET as dataType , I am getting responce but I want to use "POST".I am getting the above error only on using POST. Please let me know if any one has any idea.

I have browsed about the error but not sure where to place Access-Control-Allow-Origin=true;

I am not sure where to handle in titan server.

 var saveData = $.ajax({

                  url: "http://localhost:8182/?gremlin=g.V().count()",
       dataType: 'json',
    jsonpCallback: 'callback',
      type: 'POST',
      success: function(resultData) { 
        var result=JSON.stringify(resultData);;  
        alert("Save Complete"+result); }
                  });
0

There are 0 answers