Вопрос

I'm using

Ext.getCmp('my_form').submit(
{
  url: 'http://does-not-respond.onion/',
  method : 'POST',
  waitMsg : 'Please wait...',
  timeout: 5,
  params :
  {  

The "Please wait" window doesn't disappear. How I can make it disappear and alert a message? I want it to disappear and show error message if the server does not respond, like the internets has gone away.

Это было полезно?

Решение

try checking the failureType on form action's failure

Ext.getCmp('my_form').submit({
  url     : 'http://does-not-respond.onion/',
  method  : 'POST',
  waitMsg : 'Please Wait...',
  timeout : 5,
  params  : {},
  success : function(){console.log('success...');},
  failure: function(form, action){
                if (action.failureType === Ext.form.action.Action.CONNECT_FAILURE) {
                    Ext.Msg.alert('Error',
                        'Status:'+action.response.status+': '+
                        action.response.statusText);
                }
            }
});

refer Ext.form.action.Action-property-failureType

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top