我想通過使用post或訪問我的Flash應用程序的參數訪問日誌腳本文件(例如,log.php)來保存用戶操作的日誌。
Flash是Web應用程序而不是桌面應用程序。
$.post("test.php", {a: 1, b: 2}, function(data) {
console.log(data);
});
$。員額的文件:
在jQuery中,JavaScript可以通過使用下面的代碼訪問網站上的其他文件
http://api.jquery.com/jQuery.post/
我認爲下面的ActionScript代碼等同於jQuery的$ .post()。
此代碼是否會導致jQuery的$ .post()不存在的任何問題?
有沒有更簡單和更短的方法來做到這一點?
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, function():void {
trace(loader.data);
});
var variables:URLVariables = new URLVariables();
variables.a = 1;
variables.b = 2;
var request:URLRequest = new URLRequest("test.php");
request.data = variables;
request.method = URLRequestMethod.POST;
try {
loader.load(request);
} catch (error:Error) {
trace("failed");
}
感謝。但這3種方式對我來說很難,也許是因爲我不知道mxml。 –