I could call web service from block with code below : $jsonObject=json_decode(file_get_contents("http://www.testservice.com:50001/Services/Magento.asmx/getPayer?input=".$datasJson));
How can i call service from java script? I tried with code below, but it's all not work.
urlBuilder.createUrl('http://wsq.starcosmosgroup.com:50001/Services/Magento.asmx/getPayer?input=', {}),
JSON.stringify({
parameter1: 'data1',
parameter2: 'data2'
}
UPDATE :
I tried to get the data from service for change the billing address data in checkout page. I adding the code below, and add 'jquery' to the define, but it made the other function error, so how can i get the data from the service?
billing-address.js :
getBill: function (prefix) {
payload = {
parameter1: prefix,
parameter2: 'data'
};
url = "http://www.testservice.com:50001/Services/Magento.asmx/getPayer?input="+JSON.stringify(payload);
alert(url);
$.get(url, function(response) {
data = response;
alert(response);
});
return data;
},