@garry k said:
I'm not sure that there is an http error. A value of 0 suggests that the call did not go beyond the computer. This suggests that it is possible that it has something to do with cross-domain requests. However, Sketchup does have the allow_actions_from_host which was set. I thought allow_actions_from_host was specifically for that, in otherwords to reduce security risks by allowing 1 and 1 only external call.
What we could do is rem out the "loaded" part where we add the listener for DOMContentLoaded and replace that with a button and push the data to a hidden field.
Then there is but one call back going in one direction. Now if that doesn't work then we have ruled out this being an asynchronous timing thing.
Any thoughts?
Rambling thoughts...
I've become convinced that it is not an async timing problem. I also don't think it is an http error per-se, since those report three-digit codes (your javascript labels it an "http error", not the system). I suspect the request is being killed within the javascript library without ever going to the server. Have you checked the server logs to see whether they get traffic when Walt's system logs the error? My guess is no.
I didn't find any discussion about ways for client-side code to turn off the blocking of cross-domain requests,
only server-side headers that could be returned. It seems unlikely that there is a way for client code to disable the action, since that would make it essentially useless! What good is having a lock on the door if you provide a turn button to disengage it? So, I'd be surprised if SU's allow_actions_from_host defeats this particular security feature (or if it does, I'd like to know how - this is another of the poorly explained features of the API).
From what I read, at least on many web libraries, XMLHttpRequest has an onerror event handler you can set that may provide a description of what went wrong. Something like
xmlHttpRequest.onerror = function(e) {alert("request error; " + e.status.text)};
It may be that the error message also shows up on a javascript console, if people with the problem can get one open before running the plugin.
Steve