1
이것은 UPS 운송 웹 서비스 API입니다.JSON 구문 오류를 해결하는 방법. 응답받는 방법?
{ "오류": { "코드": "4", "설명": "JSON 구문 오류"}}
AJAX 코드 :
이 오류를 얻고있다<script>
var formData = { "UPSSecurity": { "UsernameToken": { "Username":"xxx.com", "Password":"xxxxx" }, "ServiceAccessToken": { "AccessLicenseNumber":"1234D567DF67" } }, "RateRequest": { "Request": { "RequestOption":"Rate", "TransactionReference": { "CustomerContext":"Test saran" } }, "Shipment": { "Shipper": { "Name":"Saravanan", "ShipperNumber":"Y72A41", "Address": { "AddressLine":["2311 York Rd"], "City":"Sebastopol", "StateProvinceCode":"CA", "PostalCode":"95473", "CountryCode":"US" } }, "ShipTo": { "Name":"ShipToName", "Address": { "AddressLine":["195 N main st"], "City":"Sebastopol", "StateProvinceCode":"CA", "PostalCode":"95472", "CountryCode":"US" } }, "ShipFrom": { "Name":"ShipFromName", "Address": { "AddressLine":"2311 York Rd", "City":"Sebastopol","StateProvinceCode":"CA", "PostalCode":"95473", "CountryCode":"US" } }, "Service": { "Code":"03", "Description":"Express" }, "Package": { "PackagingType": { "Code": "02", "Description": "Rate" }, "Dimensions": { "UnitOfMeasurement": { "Code": "IN", "Description": "inches" }, "Length": "7", "Width": "5", "Height": "2" }, "PackageWeight": { "UnitOfMeasurement": { "Code": "Lbs", "Description": "pounds" }, "Weight": "10" } }, "ShipmentRatingOptions": { "NegotiatedRatesIndicator": "" } } } };
$.ajax({
type : "POST",
url : "https://wwwcie.ups.com/rest/Rate",
crossDomain: true,
timeout : 240000,
data : formData,
dataType : 'json',
success : function(response)
{
alert("result="+response);
}
});
</script>
내가 잘못 된 곳을 모르겠습니다. 그러나이 요청은 "POST MAN"및 "ARC"도구로 완벽하게 실행됩니다. 답변을 업데이트하십시오.
정말 좋은 답변입니다. 귀하의 답변에 감사드립니다. –