I'm having two pages with similar textboxes when user inserts data into first page and goes to next page, if he need to give same data am adding a checkbox, when user clicks it same data which is in session from before page has to be get into the second page variables through ajax. can someone help me please. thanks
2条回答 默认 最新
- dpbfb7119 2013-08-21 06:27关注
Response for the Comment
I made sample code which will give you idea about how to can do this.
jQuery Code for checkbox change event
$(function(){ $('input:checkbox').change(function(){ if($(this).is(':checked')) { $.ajax({ url : 'script.php', success : function(session) { $('input:text').val(session); } }); } }); });
HTML
<input type="text" /> <input type="checkbox" />
script.php
<?php session_start(); echo $_SESSION['name_of_the_session_variable']; exit; ?>
EDIT
$("#checked").click(function() { if ($(this).is(':checked')) { $('#provisional_total_public_funding').val(<?php echo empty($this->session->store['actual_info']['actual_total_public_funding']) ? '' : $this->session->store['actual_info']['actual_total_public_funding']; ?>); } });
Ajax Request Response
<select name="fin_year" id="fin_year"> <option value="" >Please select an year</option> <option value="<?= $actFinYr; ?>"><?= $actFinYr; ?></option> </select> <script type="text/javascript"> $(function(){ $('#fin_year').change(function() { var options = $(this); if(options.val() != '') { $.ajax( { url : 'CODEIGNITER_HTTP_URL/'+options.val(), beforeSend : function() { //show loading }, success : function(response) { //play with the response from server. } }); } }); }); </script>
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 素材场景中光线烘焙后灯光失效
- ¥15 请教一下各位,为什么我这个没有实现模拟点击
- ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
- ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
- ¥20 有关区间dp的问题求解
- ¥15 多电路系统共用电源的串扰问题
- ¥15 slam rangenet++配置
- ¥15 有没有研究水声通信方面的帮我改俩matlab代码
- ¥15 ubuntu子系统密码忘记
- ¥15 保护模式-系统加载-段寄存器