我想追加textboxValue到URL - ?test.php的附加JavaScript變量jQuery的AJAX網址
網址應爲test.php的變量= 「textboxValue」
var textboxValue = document.getElementById("textbox").value;
window.onload = function() {
window.addEventListener('shake', shakeEventDidOccur, false);
//define a custom method to fire when shake occurs.
function shakeEventDidOccur() {
$.ajax({url:"test.php?value=var textboxValue"});
}
我怎樣做這個?
'$阿賈克斯(網址:{url: 「test.php的價值=?」 + textboxValue});' - 字符串連接 - 你也可能要移動'VAR textboxValue =文件.getElementById(「textbox」)。value;'到'shakeEventDidOccur',這樣我們將從輸入 – 2014-10-01 13:25:20
'$ .ajax({url:「test.php?value =」+ textboxvalue});' – Hackerman 2014-10-01 13:25:26
可能的重複:http://stackoverflow.com/questions/3066070/using-jquery-to-make-a-post-how-to-properly-supply-data-parameter – xDaevax 2014-10-01 13:52:06