i not able call rest service localhost created filter class , added below mention code.
filter class code :
response.addheader("access-control-allow-origin", "*"); response.addheader("access-control-allow-methods", "post, get, options, put, delete, head"); response.addheader("access-control-allow-headers", "x-pingother, origin, x-requested-with, content-type, accept"); response.addheader("access-control-max-age", "1728000");
now able call when moved code qa have loadbalancer , again not able call , getting same error mentioned below
error : xmlhttprequest cannot load https://scv-qa.com/services/sur/data. no 'access-control-allow-origin' header present on requested resource. origin 'http://www.w3schools.com' therefore not allowed access.
ajax call :
$.ajax({ type: "post", url: "https://scv-qa.com/services/sur/data", data: json.stringify({surid:1}), datatype: "json", contenttype: "application/json; charset=utf-8", success: function (data) { alert(1); }, error: function (jqxhr) { alert(2); } });
Comments
Post a Comment