dongtangjie0495 2016-01-13 10:33
浏览 57

使用knockout.js在第二页滑块上获取第一页输入值

I have a 2 pages, first page with a form

<form action="index.php/moneyexchange/save_userinput" method="post">
 <input type="text" placeholder="Amount in &euro;">
  <a type="submit" style="background-color:#fff; color:#66cccc;" href="<?php echo base_url();?>index.php/money/firstpage">Borrow</a>
</form>

And in the second page I have a slider using KNOCKOUT JS functionality.

<input id="ex2" data-slider-id="ex2Slider" type="text" data-bind="sliderValue: {value: amount, min:0, max: 5000, step: 1, tooltip: 'always', formatter:formatter2}"
            style="display: none;">

What I want to do is get the Amount value from the first page and show it on the knockout js sliders. Right now I am showing in the sliders a value of 2500.

self.amount = ko.observable(2500);
    var amount = ko.observable(2500);
    self.formatter1 = function(amount) {
      return amount + ' kk';
    }

Can someone help me in how to get the value from the first page and add to the observable of second page so the sliders start with that value. Thanks for the help. I dont mind if I can even bring the data from cookies, but what I am trying to do normally right now is load this data, to codeigniter controller like this,

public function save_userinput(){
        $this->load->helper('form');
        $form_data = $this->input->post();
    }

And then initialize it in the knockout js File which I have, but I need a proper way of doing it.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 划分vlan后不通了
    • ¥15 GDI处理通道视频时总是带有白色锯齿
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制
    • ¥15 merge函数占用内存过大
    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大