ABORT_ERR: XMLHttpRequest Exception 102: The user aborted a request in synchronous requests on bada

980 Views Asked by At

Hi everyone I amsending one string in post method for that I have following code:

function sendText(txt)
    {

        var internetUrl="http://myURL/";
        var url =internetUrl+ encodeURI("customer/Ri_logon.asp?requestString=");
        var parameters = 'manish|^test1234|^|^X|^11111985|^1.0|^|$';
        alert(url);
        alert(parameters);
        txt = parameters;
        var xhr = new XMLHttpRequest();
        xhr.open('POST', url, true);
        xhr.onload = function(e) {
          if (this.status == 200) {
            console.log(this.responseText);
            alert(this.responseText);
          }
          alert("!!!"+this.status);
        };

        xhr.send(txt);
      }

    </script>

I got error at xhr.send(txt); errorr is: ABORT_ERR: XMLHttpRequest Exception 102: The user aborted a request in synchronous requests at xhr.send(txt);same code runs on blackberry ,symbian and android. But on Bada I got error.

In manifest.xml I had given Privilege as:

<Privileges>
    <Privilege>
        <Name>WEB_SERVICE</Name>
    </Privilege>
    <Privilege>
        <Name>SYSTEM_SERVICE</Name>
    </Privilege>
    <Privilege>
        <Name>HTTP</Name>
    </Privilege>
    <Privilege>
        <Name>NET</Name>
    </Privilege>

In Thanks in advance. Any help will be appreciated.

1

There are 1 best solutions below

2
AudioBubble On

Your question is tagged with jQuery; why aren't you using it?

$.post(url, txt, function(data) { console.log(data); });

My experience is to never use XHRs in your code. Different browsers all have different implementations and the API itself is pretty rigid and verbose (in my humble opinion).