[Tizen Application-dev] What is wrong with XmlHttpRequest

Daehyeon Jung darrenh.jung at samsung.com
Wed Oct 24 08:24:36 GMT 2012

Hi Eduard,

Here's result in my system

Press "send sync"
js/xhr.js (19) :Exception:Error: INVALID_STATE_ERR: DOM Exception 11

Press "sync to google"
js/xhr.js (19) :Exception:Error: INVALID_STATE_ERR: DOM Exception 11

Press "send async"
js/xhr.js (37) :async
js/xhr.js (37) :INVALID_STATE_ERR: DOM Exception 11: An attempt was made to use an object that is not, or is no longer, usable.

Press "sync jquery to google"
error:{PP"readyState":4,"responseText":"\n\n\n Error 405 (Method Not Allowed)!! 1\n \n ~~~~~~~~~~~~~

Press "sync jquery"
error:{"readyState":0, "status":0,"statusText":"Error: NETWORK_ERR:XMLHttpRequst Exception 101"}

Those results are same both emulator and simulator. Which SDK Version do you use currently? In my system-SDK 2.0 alpha- has no problem with your application. Make sure internet connection in your emulator(test via browser).


------- Original Message -------
Sender : Eduard<seapost at gmail.com>
Date : 2012-10-24 16:37 (GMT+09:00)
Title : [Tizen Application-dev] What is wrong with XmlHttpRequest

Can you help me 
I can not use XMLHttpRequest on Tizen Emulator.

When I use XMLHttpRequest object in sync mode then I get 
ABORT_ERR: XMLHttpRequest Exception 102: The User aborted a request in synchronous requests

In async mode I can interrupt my send only via timeout

Also i have added <access> tag to config.xml
<access origin="" subdomains="true"/>
<access origin="http://google.com/" subdomains="true"/>

It is a example

function getXmlHttp(){
  var xmlhttp;
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
      xmlhttp = false;
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  return xmlhttp;

function sync(url){
    var xhr = getXmlHttp();
     xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
 xhr.open('POST', url, false);
 if(xhr.status == 200) {
 } else {


function async(url){
var xhr = getXmlHttp();
xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
xhr.open('POST', url, true);
xhr.onreadystatechange = function() {
  if (xhr.readyState == 4) {
  if(xhr.status == 200) {

function sync_jquery(url, async, data){
      type : "POST",
    url : url,
contentType: "application/json; charset=utf-8",
       data: JSON.stringify(data), 
    cache : false,
    async : async,
    success : function(data) {
    error :  function(e) {

<!DOCTYPE html>
    <script src="tizen-web-ui-fw/latest/js/jquery.js"></script>
    <script type="text/javascript" src="./js/xhr.js"></script>

<button onclick="sync('');">send sync</button>
    <button onclick="sync('http://google.com');">sync to google</button><br>
    <button onclick="async('');">send async</button><br>
    <button onclick="sync_jquery('',false,{type: 'ready'});">sync jquery</button>
    <button onclick="sync_jquery('http://google.com',false,{});">sync jquery to google</button>

Best regards,
 Eduard Serdyuk                          mailto:seapost at gmail.com

Jung, Daehyeon 
Assistant Engineer 
Software R&D Center, Samsung Electronics 
Mobile: +82 (10) 9114-0630

More information about the Application-dev mailing list