Below code working in IE but not Chrome. And I verified the service actually went thought to the browser.
I believe something wrong when it is passing the parameters like below
url: GetSaleTax + encodeURIComponent("(066,'
'," + city + "," + state + "," + zip + ",USA)"),
But I do not know how to fix it. I also have another service call and it is working but that one does not need to pass parameters.
Second Question is: I want pass SalesTaxRate to input text box "taxRate". Please help.
return error:
XMLHttpRequest cannot load http://clientaccesstest.abc.com/wcf/orders/RestService/ProQuoteServiceJVC/GetSaleTax(066%2C''%2CCOLUMBUS%2CIN%2C47201%2CUSA)?_=1428433379116. No 'Access-Control-Allow-Orig
in' header is present on the requested resource. Origin '
http://localhost:62937' is therefore not allowed access.
export result after service is called:
<Status>Completed</Status>
<CustomerN
umber></Cu
stomerNumb
er><ShipTo
City>COLUM
BUS</ShipT
oCity><Shi
pToState>I
N</ShipToS
tate><Ship
ToZip>4720
1</ShipToZ
ip><ShipTo
Country>US
A</ShipToC
ountry><Sa
lesTaxRate
>7.000</Sa
lesTaxRate
>
Script:
<script type="text/javascript">
function GetSaleTaxList(city, state, zip) {
city = "COLUMBUS";
state = "IN";
zip = "47201";
var GetSaleTax = "http://clientaccesstest.abc.com/wcf/orders/RestService/ProQuoteServiceJVC/GetSaleTax";
if (city == '' || state == '' || zip == '' ) {
//setSaleTaxInfo("NO RATE");
}else if (state == 'XX') {
//setSaleTaxInfo("NO RATE");
}else{
$(document).ready(function
() {
//alert(GetSaleTax);
$.ajax({
cache: false,
type: "GET",
async: false,
dataType: "json",
contentType: 'text/plain',
url: GetSaleTax + encodeURIComponent("(066,'
'," + city + "," + state + "," + zip + ",USA)"),
success: function (data) {
$('#data').html(data);
alert(data + " : data");
if (data == null)
return;
//setSaleTaxInfo(data);
//resultObj = jQuery.parseJSON(data);
//if (resultObj.Status != 'Failed') {
// $('#json').html(setSaleTax
Info(resul
tObj.Data)
);
//}
},
error: function (xhr) {
//$('#data').html(xhr.resp
onseText);
alert(xhr.responseText + " : error GetSaleTax");
}
});
});
}
}
</script>
<input type="text" name="taxRate" id="taxRate">