我想發送一個包含圖像base64(png)值(GET請求太大)的JavaScript變量。我如何發送這個base64值到php頁面(POST請求),以解碼base64,然後保存它。如何將javascript變量數據發送到php
var base64 = this.tobase64(); // store base64 value to this variable
$.post('/js/uploadify/handler.php', {basevalue: base64});
});
window.location = "http://localhost/file/handler.php";
我想上面的代碼,但它不工作,
我想用一個按鈕的onclick事件發送的值(這是不是一個提交按鈕)。我沒有使用表格。
PHP代碼
$val = $_POST['basevalue'];
echo $val;
我得到通知:未定義指數:basevalue錯誤
感謝!
發佈php代碼。 – Kaloyan 2013-04-04 21:22:23
'window.location'可能會破壞POST。 – 2013-04-04 21:25:26
check edit添加了php代碼 – user1910290 2013-04-04 21:26:47