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 fluent的在模拟压强时使用希望得到一些建议
    • ¥15 STM32驱动继电器
    • ¥15 Windows server update services
    • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
    • ¥15 模糊pid与pid仿真结果几乎一样
    • ¥15 java的GUI的运用
    • ¥15 Web.config连不上数据库
    • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
    • ¥15 怎么配置广告联盟瀑布流
    • ¥15 Rstudio 保存代码闪退