Xhr with blackberry phone

I am trying to send xhr using phonegap to a blackberry. Currently, when I make a request, it fails. I tried using jQuery jQuery.getJSON(url , callback),

xhr object

var xmlhttp = new XMLHttpRequest();

//callback function when XMLHttpRequest is ready
xmlhttp.onreadystatechange=function(){
    if(xmlhttp.readyState==4){
        if(xmlhttpForTGT.status==200){

            response = xmlhttpForTGT.getResponseText()
        }
        else{
            alert("Request Failed")
        }
    } 
}

xmlhttp.open("GET", url , true)
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
xmlhttp.send()

and xui

x$('#home').xhr(url, 
    {method: 'get',
    callback: function(){ alert('made request') }});

and still i can't get them to work. Could anyone else get xhr to work? I am using JRE4.6.1 and am using eclipse for the development environment. No errors occur when I try to fulfill requests, any advice?

+3
source share
1 answer

phonegap-blackberry, - XmlHttpRequest , open() . , - phonegap-blackberry RIM-, WebKit, , , - .

, , Java HTTP- . JavaScript PhoneGap PhoneGap API. : http://wiki.phonegap.com/Known-issues-(BlackBerry)

: . . API, JSON.

:

navigator.network.XHR('http://www.mysite.com/myapi',
    'This is my POST data, or I could pass in "null" for empty POST data',
    function(response) {
        // This is my success callback.
        // Do something with the JSON response object here.
    });

, .

+2

Source: https://habr.com/ru/post/1755619/


All Articles