Languages

Menu
Sites
Language
Ajax call's are not working in tizen 2.2 SDK

 

I found some issue like this in google

 

https://lists.tizen.org/pipermail/general/2013-April/002026.html

 

In my case, I also have javascript code to connect server and get data using Ajax.

The code which was working well in 2.1 sdk is not working after update version 2.2.

I installed it after I uninstalled 2.1sdk using sdk manager.

 

But, I don't think it is ajax problem cuz I tested some ajax sample code in 2.2 version.

It is not server problem and ajax code error. I checked it. That works in 2.1 sdk.

 

Anybody who have same problem and solve it ?

What do you think about this problem ?

 

 

Thanks,

Jenny

 

Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

10 Replies
talari praveen kumar
Hi Please check whether you have added in config.xml file. I have tested with the below code it is working fine
 var token='14941239b3fa26429fd411e93c162d4a3f5958faa35b43456';
    var cityName="hyderabad";
    var theUrl_current = "https://pais-dev.zypr.net/api/v2/weather/current/?token=" + token + "&placename=" + cityName;
	console.log("token="+token);
	var request = $.ajax({
		type: 'GET',
		url: theUrl_current,
		dataType: 'json',
		data: {},
		async: true,
		cache: false,
	});
	request.success(function (msg) {
		var currentWeather = jQuery.parseJSON(request.responseText);
		console.log("current temp"+currentWeather.response.data[0].weather_current.current_temp);
	});
	request.fail(function (jqXHR, textStatus) {
		console.log( "Request failed: " + textStatus );         
	});
Please share your code so that i can test to trace the issue.
talari praveen kumar
Please check whether you have added <access origin="*" subdomains="true"></access> in config.xml file
Jenny Blossoms
Hi kumar :) I added written access but it doesn't work yet... :(
talari praveen kumar
Hi Jenny Have you tested with the code i have shared above? or else please share your code
Jenny Blossoms
I can share my code but, I guess the problem is in priviliage, config.xml and so on cuz the code was working before I update version2.2. Should I delete some data after updating version ? hmn.... Anyway, this is my code.

$('#requestToken').click(tokenRequest);



function tokenRequest() {
		$.ajax({

		url : 'https://www.aaa.com/api/mobile/authtoken',     //I can't share the url and header
		headers : {
			'header1' : 'dataSample',
			'header2' : 'sample2'
		},
		type : 'GET',
		dataType : 'xml',
		success : function(xmlinfo) {
			alert("success ");

			// Global variables
			var rsp_state = $(xmlinfo).find("tag").attr("state");

			
			if (rsp_state == "ok") {
				
				sessionID = $(xmlinfo).find("session").attr("id");
				listRequest();
			} 
		},
		error : function(request, error) {
			alert("ERROR request:" + request + "error : " + error);
		},
		complete : function(xmlinfo, status) {
			console.log("Complete  xmlinfo: " + xmlinfo + "status : " + status);
			
		}
	});
}



< a href="ApplianceList.html"  id="requestToken" data-role="button" data-inline="true">Click and request data< /a>

youngsik yoon
if you are using old config.xml generated in 2.1 sdk, you need to create new project in 2.2 sdk. only copy code carefully from old one and use new config.xml which is generated in 2.2.
Jenny Blossoms
I generated new basic project and than copy and paste html and javascript files except config.xml from old project. (I set the access to the url) But Not yet.... ;(
talari praveen kumar
Hi Jenny May i know what error you are getting?? Try the code by keeping "success" call back outside of ajax call, as i did in the code mentioned above.
Jenny Blossoms
The code is "success" in sdk 2.1 and than "Error" in sdk 2.2.
talari praveen kumar
Hi Jenny It is working fine for me. Please check whether you have internet connection in your emulator/device. What error you are getting in error call back?