最近我正在使用Qt-Qml的諾基亞手機。我必須向給定的HTTPS Url發送POST請求。 我正在使用QML,我試圖在沒有任何運氣的情況下使用Javascript。Https POST/GET與Qml/Qt
任何人都有一個想法嗎?可以在QML中使用Javascript來完成它? 任何建議如何使它在QT?
我打過電話這樣的功能:
var http = new XMLHttpRequest()
var url = "myform.xsl_submit";
var params = "num=22&num2=333";
http.open("POST", url, true);
//Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
print("ok");
}else{
print("cannot connect");
}
}
http.send(params);
'XMLHttpRequest.DONE'是很容易,'4'記,我猜... – 2015-08-17 19:30:12