×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Mar 2005
    Location
    Hamburg, Germany
    Posts
    281

    jquery ajax call works local but not in cloud preview: No Transport

    Hello developer,

    I try to build a webapp that takes of a webpage, extracts (scrapes) a part of it and then displays it the part inside an own UI.
    Getting the external webpage is done with jquery-ajax. I currently use 1.8.3 ( I have used the 1.7, but is was also not successful)

    In cloud-preview, I get an ajax exception: "No Transport"

    My ajax call looks like this:
    Code:
    		$.ajax({
    			url: Scraper.articleURL,
    			type: 'GET',
    			dataType: 'html',
    			success: Scraper.gotArticle, 
    			error: Scraper.notGotArticle
    		});
    Before I tried the direct load-method from jquery, but this has also not worked.

    Does anybody has an idea what the problem is?

    Regards

    Karsten Meier

  2. #2
    Wiki Moderators
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,779

    Re: jquery ajax call works local but not in cloud preview: No Transport

    jQuery is not fully supported by the S40 Web App platform - so this is expected.

    The normal ajax works fine,

    Code:
    var ajaxRequest = {
    		
    	URL: "http://www....",
    
    	init: function(){
    		//URL, success callback, failure callback		
    		this.connect(this.URL, this.responseHandler, this.failureHandler);
    	},
    
    	responseHandler: function(data) {
    		// Process data
    	},
    
    	failureHandler: function(reason){	
                    // Handle failure
    	}, 	
    	  
    	connect: function(url, successCb, failCb) {
    		
    		var xmlhttp = new XMLHttpRequest();
    		
    		xmlhttp.open("GET", url, true);
    
    		xmlhttp.setRequestHeader("Accept","application/json");	
    		xmlhttp.setRequestHeader("Cache-Control", "no-cache");
    		xmlhttp.setRequestHeader("Pragma", "no-cache");
    		
    		var that = this;
    		xmlhttp.onreadystatechange= function() {
    			
    			if (xmlhttp.readyState ==  4 ){
    				
    				if(xmlhttp.status == 200){		
    	                if (xmlhttp.responseText != null) {
    	                	successCb.call(that, xmlhttp.responseText);
    					}else{
    						failCb.call(that, "Empty response.");
    					}	
    				}else{				
    					failCb.call(that, "Connection failed: Status "+xmlhttp.status);
    				}
    			}
    		};
    		xmlhttp.send();
    	}		
    };
    
    ajaxRequest.init();
    Pankaj Nathani
    www.croozeus.com

  3. #3
    Regular Contributor
    Join Date
    Mar 2005
    Location
    Hamburg, Germany
    Posts
    281

    Re: jquery ajax call works local but not in cloud preview: No Transport

    Thank you croozeus,

    it now works in cloud preview, and more important, also on the device.

    Of course all the jquery animations do not work on the proxy browser. But selecting and DOM-manipulation works quite good so far, and jquery it is used in several example projects.
    So I hoped the jquery-ajax does also work.

    Regards

    Karsten Meier

  4. #4
    Wiki Moderators
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,779

    Re: jquery ajax call works local but not in cloud preview: No Transport

    Glad it works! Happy to help
    Pankaj Nathani
    www.croozeus.com

  5. #5
    Regular Contributor
    Join Date
    Mar 2005
    Location
    Hamburg, Germany
    Posts
    281

    Re: jquery ajax call works local but not in cloud preview: No Transport

    A follow-up: In the Location-webinar, they succesfully used jquery with ajax. The said we need to set
    "crossDomain: false," when we use a success- or failure-handler.

Similar Threads

  1. Cloud preview not work since Sep 7
    By zhoun in forum Nokia Asha Web Apps
    Replies: 11
    Last Post: 2013-04-23, 12:30
  2. 'Expectation failed' error when trying to do cloud preview
    By ariefbayu in forum Nokia Asha Web Apps
    Replies: 6
    Last Post: 2012-04-11, 07:21
  3. Cloud :: Developer Convention '11 in Hamburg (Cloud Hackathon)
    By renebuest in forum News and Announcements
    Replies: 1
    Last Post: 2011-10-31, 11:07
  4. Replies: 4
    Last Post: 2010-12-10, 16:23
  5. AJAX - 1012 Error - in Aptana Preview
    By davecozens in forum Symbian
    Replies: 2
    Last Post: 2009-09-29, 12:46

Posting Permissions

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