def requestLoaded
      begin
        status = Native(`#{@xhr}.status`)
        raise if status >= 300
        json = JSON.parse(`#{@xhr}.response`)
        @callback.call(json)
      rescue => error
        @failed = true
        @error_callback.call(status, error)
      end

      destroy
    end
def requestLoaded
      begin
        status = Native(`#{@xhr}.status`)
        raise if status >= 300
        json = JSON.parse(`#{@xhr}.response`)
        @callback.call(json)
      rescue => error
        @failed = true
        @error_callback.call(status, error)
      end

      destroy
    end
Internal callback method, will call the success callback specified
 in initialize or the failure callback if the html return status is
 300 or higher.