純粋な JavaScript ソリューション (推奨):
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyStatus == 4) { // finished
if (xhr.status == 200) { // 200 HTTP code returned by server
}
else { // error
}
}
};
xhr.open("GET", "your-script.php?videoID=" + encodeURIComponent(videoID));
xhr.send(null);
jQuery ソリューション (プロジェクトで既に jQuery を使用している場合、または試してみたい場合に推奨):
// PHP script can access $_GET['videoID']
jQuery.get("your-script.php?videoID=" + encodeURIComponent(videoID));
// PHP script can access $_POST['videoID']
jQuery.post("your-script.php", {videoID: videoID});
jQuery.get( url [, データ ] [, 成功 (データ, テキストステータス, jqXHR) ] [, データタイプ] )
jQuery.post( url [, データ ] [, success(データ, textStatus, jqXHR) ] [, dataType ] )