1. #1
    Sencha User
    Join Date
    Nov 2013
    Posts
    8
    Vote Rating
    1
    axida is on a distinguished road

      0  

    Default Ajax communication failed

    Ajax communication failed


    When I input the URL directly in address bar in a browser, it gives the servlet reply. However, I am getting the message, "Ajax communication failed" submit the form by clicking the submit button in the codes below.
    Any thing am I missing? Thank you!

    Code:
    <!DOCTYPE html>
    <html>
    <head>
     
    <link rel='stylesheet' type='text/css' href='extjs4/resources/css/ext-all.css'/>
    <script type='text/javascript' src='extjs4/ext-all.js'></script>
    <script type='text/javascript' >
    
    
    Ext.application({  
        name : 'Books',  
        appFolder:"books",  
        launch : function() {   
        	Ext.create('Ext.form.Panel', {
        	    title: 'Simple Form',
        	    bodyPadding: 5,
        	    width: 350,
    
    
        	    // The form will submit an AJAX request to this URL when submitted
        	    url: '/jwc/test',
    
    
        	    // Fields will be arranged vertically, stretched to full width
        	    layout: 'anchor',
        	    defaults: {
        	        anchor: '100%'
        	    },
    
    
        	    // The fields
        	    defaultType: 'textfield',
        	    items: [{
        	        fieldLabel: 'First Name',
        	        name: 'first',
        	        allowBlank: false
        	    },{
        	        fieldLabel: 'Last Name',
        	        name: 'last',
        	        allowBlank: false
        	    }],
    
    
        	    // Reset and Submit buttons
        	    buttons: [{
        	        text: 'Reset',
        	        handler: function() {
        	            this.up('form').getForm().reset();
        	        }
        	    }, {
        	        text: 'Submit',
        	        formBind: true, //only enabled once the form is valid
        	        disabled: true,
        	        handler: function() {
        	            var form = this.up('form').getForm();
        	            if (form.isValid()) {
        	                form.submit({
        	                    success: function(form, action) {
        	                       Ext.Msg.alert('Success', action.result.msg);
        	                    },
        	                    failure: function(form, action) {
        	                        switch (action.failureType) {
        	                            case Ext.form.action.Action.CLIENT_INVALID:
        	                                Ext.Msg.alert('Failure', 'Form fields may not be submitted with invalid values');
        	                                break;
        	                            case Ext.form.action.Action.CONNECT_FAILURE:
        	                                Ext.Msg.alert('Failure', 'Ajax communication failed');
        	                                break;
        	                            case Ext.form.action.Action.SERVER_INVALID:
        	                               Ext.Msg.alert('Failure', action.result.msg);
        	                       }
        	                    }
        	                });
        	            }
        	        }
        	    }],
        	    renderTo: Ext.getBody()
        	});
        }  
    });  
    </script>
    
    
    
    
    </head>
    <body>
    </body>
    </html>

  2. #2
    Sencha Premium Member
    Join Date
    Dec 2011
    Posts
    41
    Vote Rating
    9
    jcdang will become famous soon enough

      1  

    Default


    When you enter it in your browser, you're doing a GET request. The default for a form submit is POST.Add "method: 'GET'" to your submit object.

  3. #3
    Sencha User
    Join Date
    Nov 2013
    Posts
    8
    Vote Rating
    1
    axida is on a distinguished road

      0  

    Default


    Thank you very much!!

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar