Passing Soap Action for Post Method using the Ajax/jquery
From the wsdl file by passing the Soap Action with the Post Method in Ajax/jquery need to get the required response . Tried out but getting as XMLHttpRequest cannot load (wsdl url ) Response to preflight
request doesn't pass access control check: No
'Access-Control-Allow-Origin' header is
present on the requested resource. Origin
'null' is therefore not allowed access.
Please let me what is the issue. below is the code I had tried out
$.fn.getProducts = function(CustID) {
var products =[];
// var productsUrl = "<script src="../../../wsdl/test.js"></script>";
$.ajax(
{
url: productsUrl,
headers: {
'Accept': 'application/jsonp',
'Accept-Language': 'en',
'Access-Control-Allow-Origin': '*'
},
method: 'POST',
dataType: "jsonp",
crossOrigin: true,
data: {'CustID': 12611} ,
jsonpCallback:$fn.getProducts(CustID)});
alert('getProducts');
/jsonpCallback:$fn.getProducts(customer.cust_id)});
$fn.products = function(resp) {
console.log(resp);
}
}
Thanks