This thread contains the backstory to what I'm trying to accomplish: https://www.zen-cart.com/showthread.php?219741
I'm trying to use this API from UPS' developer tools: https://www.ups.com/upsdeveloperkit/...urce?loc=en_US
I've read the documentation in the kit but I have really no knowledge of XML, JSON, or using API's in general. I have an account and an access key for the API but I don't know how to implement it with ZenCart.
I would like to run a request from this API during step 1 (shipping) of the Zen Cart checkout to see if the chosen shipping address of the customer is residential or commercial (really just residential, or not) and then do x thing depending on what the result of that check is.
------
As of right now I don't think I'm doing it right at all...
I looked for some API tutorials and one I read led me to try this in my tpl_checkout_chipping_default.php file:
HTML Code:<div id="dump"></div> <input type="button" value="JSON" onclick="loadUPS()" />When I click the dummy button I'm just trying to get any kind of results to appear in the dummy div. Right now all that happens is an error in the console:Code:<script type="text/javascript"> function loadUPS() { $('#dump').html('Loading'); $.ajax({ type:'GET', url:"https://wwwcie.ups.com/json/XAV", username:"my_username", password:"my_pass", AccessLicenseNumber:"ACCESSKEY", success:function(dump) { $('#dump').append(dump); }, dataType:'jsonp' }); }; </script>------"Refused to execute script from … because its MIME type (‘application/json’) is not executable, and strict MIME type checking is enabled"
Could really use some help, I'm not sure if I'm on the right track at all or completely doing it wrong.


Reply With Quote
