语言

Menu
Sites
Language
problem with developping on the tizen device

Hi every body

this code that is  a part of my applicationn, don't work on the tizen device while it work normally on the tizen simultor ... can any one have a look and tell me why !! if it's a problem with the balise form or with the dom parser ! can anyone tell me how to solve it ?

thx



<!DOCTYPE html>

<head>
                                           

</head>
<body>
<div id="result">
</div>
<div align="center">
<form  name="myForm">

<button  type="submit">go</button>
</form>  
</div>

<script>
    //var doc;
	var xhr = new XMLHttpRequest();
	xhr.open('GET', 'http://www.sntri.com.tn/html_ar/result_tarif_horaire_sntri.php', true);
	//xhr.setRequestHeader('Origin', 'www.sntri.com.tn');
	//xhr.setRequestHeader('Allow-Control-Allow-Origin', '*');
	xhr.send();
	xhr.onreadystatechange = function() {
		if(4 === xhr.readyState) {
			if(200 === xhr.status) {
				var parser = new DOMParser();
				var doc = parser.parseFromString(xhr.responseText, 'text/html');
				var myForm = document.forms.myForm;
				//console.log(doc);
				var selectDep = doc.getElementsByName('code_arret_dep')[0];
				var selectArr = doc.getElementsByName('code_arret_arr')[0];
				doc.getElementBy
				//console.log(select);	
				myForm.appendChild(selectDep);	
				myForm.appendChild(selectArr);
				//console.log(xhr.responseText);
	
				myForm.onsubmit = function(e) {
					e.preventDefault();
					var xhr = new XMLHttpRequest();
					xhr.open('POST', 'http://www.sntri.com.tn/html_ar/result_tarif_horaire_sntri.php', true);
					xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
					xhr.send('code_arret_dep='+selectDep.value+'&code_arret_arr='+selectArr.value);
					
					xhr.onreadystatechange = function() {
						if(4 === xhr.readyState) {
							if(200 === xhr.status) {
								var parser = new DOMParser();
								var doc = parser.parseFromString(xhr.responseText, 'text/html');
								var result = document.getElementById('result');
								var tablex = doc.getElementById('tablex');
								//console.log(doc);
								result.appendChild(tablex);
								//console.log(xhr.responseText);
							}
						}
					}
					
					console.log(selectDep.value);
					console.log(selectArr.value);
				}
			}
		}
	};
</script>
</body>

</html>

 

响应

2 回复
woochan lee

hello,

You'd better to ask this question in web  application development board.

https://developer.tizen.org/forums/web-application-development/

 

thanks.

Seoghyun Kang

Dear wassim ben hamida,

 

If you have a question about the web application, please use the web forum.

 

By the way,

I think that following code snippet will helpful for you.

This code shows to how get the data from web server and parse it.

https://developer.tizen.org/community/code-snippet/web-code-snippet/how-get-weather-information-web-server

 

Please refer it.

Thanks.