【发布时间】:2016-01-13 13:43:10
【问题描述】:
这是以前提出的问题,但我需要认真的帮助,因此请从朋友那里重新发布。我这里有一个输入字段。
<form action="index.php/money/save_userinput" method="post" >
<input type="text" placeholder="Amount in €">
<a type="submit" style="background-color:#fff; color:#66cccc;" href="<?php echo base_url();?>index.php/money/firstpage">GetCash</a>
</form>
然后我尝试将此值从输入字段获取到在调试时未接收任何值的控制器中。这就是函数。
public function save_userinput(){
$this->load->helper('form');
$form_data = $this->input->post();
}
我现在要做的是使用第一页中的值并在完全不同的页面中的淘汰赛 js 滑块中获取这些值。 这是滑块代码。
<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;">
我有一个具有该功能的淘汰赛js页面,
self.amount = ko.observable(2500);
self.formatter1 = function(amount) {
return amount + ' kk';
}
我需要将从控制器获得的值放入 observable 中,但我完全不知道该怎么做,我尝试了不同的方法,但没有奏效。我正在考虑使用 Ajax 调用该函数,但我不确定哪个应该工作。
【问题讨论】:
标签: javascript php codeigniter knockout.js knockout-2.0