将值从 noUIslider 发送到 php 文件
send value from noUIslider to php file
我尝试使用查询 post.
将值从我的滑块发送到 saveprofile.php 文件
这是我的fiddle:http://jsfiddle.net/uzq7yym3/
这里是 jquery post:
的代码片段
$(document).ready(function(){
var einestundeslider = document.getElementById('slider_einestunde');
$("#saveprofilebutton").click(function(){
$.post('saveprofile.php', 'val=' + einestunde.noUiSlider.get(), function (response) {
alert(response);
});
});
});
saveprofile.php 看起来像这样:
$value = $_POST['val'];
echo "I got your value! $value";
但我什么也没收到:/
根据 JS fiddle,您在此行末尾的 html 语法中缺少“>”:<div id="slider_einestunde"></div
所以Html代码应该是这样的:
<form action="saveprofile.php">
<div id="slider_einestunde"></div>
其次,您使用了错误的变量名称来获取值,实际值为:'einestundeslider' 但您使用的是 'einestunde'
你的 JS 的固定版本 fiddle:http://jsfiddle.net/48n4jp33/
我尝试使用查询 post.
将值从我的滑块发送到 saveprofile.php 文件这是我的fiddle:http://jsfiddle.net/uzq7yym3/
这里是 jquery post:
的代码片段 $(document).ready(function(){
var einestundeslider = document.getElementById('slider_einestunde');
$("#saveprofilebutton").click(function(){
$.post('saveprofile.php', 'val=' + einestunde.noUiSlider.get(), function (response) {
alert(response);
});
});
});
saveprofile.php 看起来像这样:
$value = $_POST['val'];
echo "I got your value! $value";
但我什么也没收到:/
根据 JS fiddle,您在此行末尾的 html 语法中缺少“>”:<div id="slider_einestunde"></div
所以Html代码应该是这样的:
<form action="saveprofile.php">
<div id="slider_einestunde"></div>
其次,您使用了错误的变量名称来获取值,实际值为:'einestundeslider' 但您使用的是 'einestunde'
你的 JS 的固定版本 fiddle:http://jsfiddle.net/48n4jp33/