Results 1 to 2 of 2

Thread: the 'failure' event of 'Ext.util.JSONP.request' not work

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Sep 2011
    Location
    China
    Posts
    8

    Exclamation the 'failure' event of 'Ext.util.JSONP.request' not work

    When server response 404 error,the scripttag created by 'Ext.util.JSONP.request' will remain in header,and block other jsonp request.And the 'failure' event is not fired by 404 error.

    The scripttag has a onerror event can catch this error.How can I overrite the jsonp request or extend it with a error handling?

  2. #2
    Sencha User
    Join Date
    Sep 2011
    Location
    China
    Posts
    8

    Post

    I already overwrite the jsonp request in order to support the failure event.
    It work properly now.

    Ext.util.JSONP.request = function (o) {
    o = o || {};
    if (!o.url) {
    return;
    }

    var me = this;
    o.params = o.params || {};
    if (o.callbackKey) {
    o.params[o.callbackKey] = 'Ext.util.JSONP.callback';
    }
    var params = Ext.urlEncode(o.params);

    var script = document.createElement('script');
    script.type = 'text/javascript';
    if (o.failure) {
    script.onerror = function () {
    document.getElementsByTagName('head')[0].removeChild(script);
    Ext.util.JSONP.next();
    o.failure();
    }
    };

    this.queue.push({
    url: o.url,
    script: script,
    callback: o.callback || function () { },
    scope: o.scope || window,
    failure: o.failure || function () { },
    params: params || null
    });

    if (!this.current) {
    this.next();
    }
    };

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •