Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Can not post JSON to server

$
0
0

Ex:-

var url = "http://192.168.1.100/test.php";
    var xhr = Titanium.Network.createHTTPClient();
    xhr.onerror = function(e) {
        swim.lib.err('' + e.error);
        alert('HTTP ERR...');
    };
 
xhr.onload = function(e) {
         Ti.API.info(this.responseText);
         alert('success');
    };
    xhr.open("POST", url);
    //post/get and your URL
    xhr.setRequestHeader("content-type", "application/json");
    var param = {
        "user" : {
            "email" : "someone@email.com",
            "password" : "secure"
        }
    };
    xhr.send(JSON.stringify(param));
always give null !!

sdk: 3.5.1 genemotion emulator


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>