Hey!
I am sorry if this is a dumb question or anything. But i simply want to test out and use the method makewebrequest but cannot make it work. I constantly get responseCode -400 and data that is null. My code is following (Its based on the template given from eclipse):
function getInitialView() { var url = "https://www.bing.com"; // this is the data that you want to send out var params = {}; var options = { :method => Communications.HTTP_REQUEST_METHOD_GET }; // make the Communications.makeWebRequest() call to send data Communications.makeWebRequest(url, params, options, method(:onResponse)); //Template stuff //return [ new dataRetrieveView(), new dataRetrieveDelegate() ]; } function onResponse(responseCode, data) { System.println("in onReceive, responseCode=" + responseCode + ", data=" + data); }
I have tried using different content-type and responseType, but i keep getting -400...
So i tried not setting any of these as i read that "if the content type is not specified, it will default to "application/json" for GET" and that if responseType is not given the system will attempt parsing the response both as JSON, then as URL ENCODED.
How should i modify this example to not get responseCode -400 constantly? Can i not use bing as an example?
Please help me, i am confused and frustrated