==
function onCheck()
{
// It's simple page, not component, partial or controller
// Therefore this syntax is right (according October docs)
$this['myvar'] = "Hello";
}
==
<form class="dates" action="" method="POST" data-request="onCheck">
<input type='text' class='date_inout' name="start" id='start'>
<input type='text' class='date_inout' name="end" id='end'>
<input type="submit" value="Подобрать">
</form>
<h1>{{ myvar }}</h1>
qazxsw poi没有输出。我需要在表单提交后才能获得qazxsw poi,而不是myvar
或myvar
先感谢您!
你需要在ajax之后输出然后你需要这样做
onStart
现在,当你点击
onInit
它将转到== function onCheck() { $dates = post('start') . ' - ' . post('end'); return ['#myvarContsiner' => "Hello " . $dates]; // ^ this id } == <form class="dates" action="" method="POST" data-request="onCheck"> <input type='text' class='date_inout' name="start" id='start'> <input type='text' class='date_inout' name="end" id='end'> <input type="submit" value="Подобрать"> </form> <h1 id="myvarContsiner"></h1> <!-- this id ^ -->
并返回值submit button
所以基本上onCheck
将根据匹配ID在['#myvarContsiner' => "Hello " . $dates]
更新。
当你从"Hello " . $dates
返回它时,你的意志会显示出来
如果您有任何疑问请发表评论。