1. #1
    Ext User
    Join Date
    Mar 2008
    Posts
    9
    Vote Rating
    0
    mudittuli is on a distinguished road

      0  

    Default Ajax Request Failure

    Ajax Request Failure


    Hi, I am using Ext Js in my Air app., while making Ajax requests, the request fails once or twice, but after that the requests are normal, below is the code with which i am making the request.
    Any ideas about what I am doing wrong here ?

    Code:
    Ext.onReady(function() {
    	Ext.get('myButton').on('click', function(){
    		Ext.Ajax.request({
    			url: 'http://localhost/testcontroller/get_data/',
    			method: "POST",
    			params: 'name=testval',
    			success: function( r, o ){
    				alert('Success'+ r.responseText );
    			},
    			failure: function( r, o ) {
    				alert( "fail: " + r.responseText );
    			}
    		});
    	});
    });

  2. #2
    ralmeida
    Guest

    Default


    I am having a similar issue, to help debug this I am using a localhost server. I run my air app and to check if the Ajax calls are even making it to the server you can check your access logs. If they are you can use a tool like Aptana to see what is coming back form the server via the air.trace method.

    The issue I am having is that the response is good but for some reason EXT is not getting the data or not using what is given to it. I've made sure I've included all the required air files, not too sure where to go from there.

  3. #3
    Ext User
    Join Date
    Nov 2007
    Posts
    102
    Vote Rating
    0
    RobSmith is on a distinguished road

      0  

    Default


    I make extensive use of Ajax calls in my AIR applications and had never such a problem. But I do not use the success and failure properties but instead the callback property to define one method which also does the error check. Maybe your problem is related to this issue.

    Regards Rob

  4. #4
    ralmeida
    Guest

    Default


    Thank you very much! That was the issue, so using air and making the ajax calls you have to use the callback vs. the built in success / failure functions.

  5. #5
    ralmeida
    Guest

    Default


    So this may help with your ajax request in air

    Code:
    Ext.onReady(function() {
    	Ext.get('myButton').on('click', function(){
    		Ext.Ajax.request({
    			url: 'http://localhost/testcontroller/get_data/',
    			method: "POST",
    			params: 'name=testval',
    			callback: function(opt,success,responseObj) {
    			
    			    if (success) {
                                    // Yay
                                    // server data
    				var responseData = Ext.util.JSON.decode(responseObj.responseText);
                                    var data = responseData.data;
                                } else {
                                   // AJAX Fail
                                }
                            }
    		});
    	});
    });

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