Frage

I'm using easyXDM 2.4.17. I've setup RPC with a remote 'tunnel.html' which makes AJAX calls using jQuery.

For all modern browsers (those with postMessage) everything is working fine. When I test on ie7 easyXDM falls back to the HashTransport and everything still works fine except I never see the AJAX response. I can see the request is actually coming back just fine but my callback is just never being fired for some reason.

My tunnel.html file looks like this:

<!DOCTYPE html>
<html>
    <!--[if lt IE 9]>
    <script type="text/javascript" language="javascript" src="https://mydomain.net/json2.min.js"></script>
    <![endif]-->
    <script src="https://mydomain.net/easyXDM-2.4.17.js"></script>
    <script src="https://mydomain.net/jquery-1.10.2.min.js"></script>
    <script>
        function apiTunnel (endpoint, params, method, callback) {
            var options = {
                url: endpoint,
                data: params,
                type: method,
                complete: function (xhr) {
                    var response = {};
                    try {
                        response.data = JSON.parse(xhr.responseText);
                    } catch (ex) {
                        response.error = xhr.responseText;
                    }
                    callback(response);
                }
            };
            jQuery.ajax(options);
        }
        var rpc = new easyXDM.Rpc({}, {local: { apiTunnel: apiTunnel }, serializer: JSON});
    </script>
</html>

UPDATE: after some debugging it looks like my response is getting stuck in the queue. The tunnel side is failing on an image from the host page. This clogs the queue and never lets my AJAX response through. Any ideas?

UPDATE 2 If I set a timer to remove the waiting lock and dispatch the queue after 2 seconds it works. I don't feel great about this but it does work. I'm not sure why the initial call is failing -- I'd much rather fix the root issue if possible, I'm just not sure I fully understand what the root issue is.

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top