doushi8186 2015-08-05 20:13
浏览 31
已采纳

从noUIslider发送值到php文件

I try to send the value from my slider to the saveprofile.php file with query post.

Here is my fiddle: http://jsfiddle.net/uzq7yym3/

and here the code snippet for 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 looks like this:

   $value = $_POST['val'];
   echo "I got your value! $value";

But i receive nothing :/

  • 写回答

1条回答 默认 最新

  • douxin2011 2015-08-05 21:28
    关注

    As per JS fiddle you are missing '>' in html syntax at the end of this line: <div id="slider_einestunde"></div

    So Html code should be like this:

    <form action="saveprofile.php">
    <div id="slider_einestunde"></div>
    

    Secondly you are using wrong variable name to get the value, actual value is: 'einestundeslider' but you are using 'einestunde'

    Fixed version of your JS fiddle: http://jsfiddle.net/48n4jp33/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计