Tag: codeigniter

我尝试在Codeigniter中通过jQuery ajax()提交表单……但没有任何反应…… :(

对不起这个重复和重复的问题,但我真的不知道如何解决。 有一个按钮和两个text_input,当我点击这个按钮时,如果它正常工作,我会看到一个警报并向我显示“成功”,但不幸的是,我什么也看不见。 没有 !! 我不知道为什么:( 请帮助我,请……我在stackoverflow或其他网站上阅读了很多有关codeigniter的教程,但是我找不到任何可以解决我的问题,请教我们。 这是一个非常简单的表格 文件名:test.php test <link rel="stylesheet" href="”> <link rel="stylesheet" href="”> <script src="”> <script src="”> <script src="”> USER: NAME: 我想通过jQuery Ajax()以这种forms提交数据,JS文件如下 文件名:practice.js $(document).ready(function(){ $(“#test_form”).submit(function(e){ e.preventDefault(); var tdata= $(“#test_form”).serializeArray(); $.ajax({ type: “POST”, url: “http://localhost/index.php/static_data/test_add”, dataType: json, data: tdata, success:function(tdata) { alert(‘SUCCESS!!’); } }); }); }); 以下是我的控制器 文件名:static_data load->view(‘test’); } public function test_add() […]

获取typeError:运行脚本时,在firebug中未定义e

我无法弄清楚我的代码有什么问题。我从post中获取数据作为数组,然后我在框中显示该数据。 function worker() { var a = $(“#BeeperBox”); var delay =2000; $.ajax({ url: ‘/index.php/admin/getLatest’, success: function(data) { $.each(data.upda,function(i, v){ var out = v.name + v.mob ; $(‘span.blueName’).html(out); $(“#BeeperBox”).show(); timerId = setTimeout(function () { a.hide(); }, delay); }); }, complete: function() { // Schedule the next request when the current one’s complete setTimeout(worker, 50000); } }); […]

重定向后CodeIgniter flashdata无法正常工作

我已经设置了这样的flash数据 $this->session->set_flashdata(‘dispMessage’,’my message is here’)); 我在会话库中发现了该消息,但未在重定向页面中显示。 我使用的是codeigniter 2.2.0版。 谁能帮忙……?

我正在尝试动态显示数据aj ajax

控制器: 在我使用两个表类别和secound sub_category在类别我获取类别名称动态显示在Sub_Category我获取图像,价格,标题 public function product_grid() { $id= $this->input->post(‘dataid’); echo ‘Data-Id is form controller: ‘.$id ; $this->PizzaUp_User_model->getid($id); $data[‘res’] = $this->PizzaUp_User_model->select(‘category’); $data[‘rs’] = $this->PizzaUp_User_model->get_cetegory(‘sub_category’); $this->load->view(‘product_grid’,$data); } 查看文件 <div data-filter="” data_id=”” name=”id” class=”cbp-filter-item button_id”> <div class="cbp-item “> <img src="https://stackoverflow.com/questions/44587319/i-am-trying-to-display-data-dynamically-id-sing-ajax/” alt=””> <a href="https://stackoverflow.com/questions/44587319/i-am-trying-to-display-data-dynamically-id-sing-ajax/more_get_id/” class=”cbp-singlePage cbp-l-caption-buttonLeft”>Add to cart <a href="https://stackoverflow.com/questions/44587319/i-am-trying-to-display-data-dynamically-id-sing-ajax/” class=”cbp-lightbox cbp-l-caption-buttonRight”>view larger 使用Ajax获取并传递id $(document).ready(function() { $(“.button_id”).click(function(){ var dataid=$(this).attr(‘data_id’); […]

如何在codeigniter中将分页更改为无限滚动

我想将此分页页面更改为无限滚动。 我正在使用codeigniter。 我已经搜索过jquery和ajax,但我真的不明白如何在我的代码中实现它。 所以请帮我编辑我的分页代码到无限滚动。 。 。 我好几天都在挣扎。 如果你能帮助我,我将非常感激。 谢谢 :) HomeController.php public function list_voucher($page=NULL, $orderBy=NULL) { if($this->session->userdata(‘logged_in’)) { $session_data = $this->session->userdata(‘logged_in’); $data[‘nama’] = $session_data[‘nama’]; $data[‘id’] = $session_data[‘id_user’]; $data[‘tipeUser’] = $session_data[‘tipe_user’]; } else{ $data[‘nama’] = “”; $data[‘id’] = “0”; $data[‘tipeUser’]=””; } $data[‘url_image’] = $this->imageUrl; $data[‘notif’] = ”; $config[‘base_url’] = base_url().’/home_controller/list_voucher/’; $data[‘jmlh_rows’] = $this->voucher->getAllDeals(); $total_row = $data[‘jmlh_rows’]->num_rows(); […]

在jQuery中收集复选框值并在提交时将其POST

我已经提到过这篇文章了: 发布多个复选框值的数组 这个jQuery论坛post: http://forum.jquery.com/topic/checkbox-names-aggregate-as-array-in-a-hidden-input-value 我试图使用jQuery收集隐藏输入字段中的复选框值的数组(或带逗号的连接字符串,无论如何)。 这是我正在使用的脚本代码: $(“#advancedSearchForm”).submit(function() { var form = this; $(form).find(“input[name=specialty]”).val(function() { return $(“input:checkbox”,form).map(function() { return $(this).attr(“name”); }).get().join(); }); }); 相关HTML的片段: <form id="advancedSearchForm" name="advancedSearchForm" method="post" action="”> <input type="checkbox" name="FCM" id="FCM" class="chk" value="FCM" /> 我已经尝试在jQuery中将“submit”更改为“submit3”,这显然会破坏。 当我print_r($ _ POST)时,复选框正确POST,但精简隐藏变量没有。 (它发布,但是一个空值。)复选框使用CI的黑客set_value()函数正确保留(Derek需要在主干中实现这个……但这是另一个故事) 我确信我做的事情是错误的,很容易指出。 在过去的2个小时里,我一直在撞墙,尝试各种function,改变大量的东西,并在Chrome开发工具中分析它(没有显示任何错误)。 感谢帮助。 🙂

用空格传递字符串变量

在以下代码中: function updateView(set) { $.post(“”+set, function( data ) { $( “#content” ).html( data ); }); } ‘set’是一个字符串变量,可以在其中包含空格。 我注意到它有空格时它无法正常工作。 我怎样才能解决这个问题? 编辑:为清楚起见,我想保持空间完整。

需要刷新页面内容

我正在使用codeigniter框架工作,目前正致力于社交网络类的东西。 我的问题是,当用户点击Feed链接时,我需要通过重新加载页面来通知用户他们的朋友活动。 我试过以下脚本, setInterval(function() { $(‘#reload’).fadeOut(“slow”).load(‘user_feeds’).fadeIn(“slow”); }, 10000); 它增加了我的服务器的负载。 任何其他想法来实现这一目标。 提前致谢。

如何在jquery中创建多维数组/对象并通过AJAX post传递

我正在创建一个订单表单,其中包含用户可以购买的订单商品表。 输入使用数据属性来存储项目名称和每件的价格,如下所示: <input type="text" class="input-small quantity-input" data-pid="” data-min=”” data-max=”” data-price=”” data-name=”” placeholder=”quantity…”> 除了如何迭代每个数量输入项并将其添加到我可以通过AJAX Post发送的多维数组之外,我已经弄明白了。 我目前有以下代码,但是当我在$ _POST值上执行print_r时,它说:不允许的关键字符:新鲜的罗非鱼片 $(“#ccform”).validate({ rules: { firstName: { required: true }, lastName: { required: true }, email: { required: true, email: true, }, cardNumber: { required: true }, expMonth: { required: true }, expYear: { required: true }, cvv: { required: true […]

Jquery 1.5 ajax在POST上作为GET数据发送

(抱歉我的英文,它不是我的出生郎)我有一个使用codeigniter + JqueryUI的项目。 我正在考虑将JQuery版本升级到1.5,主要是因为我使用了大量的ajax调用,并且对速度的任何改进都非常感激。 所以这是我的代码,在JQuery 1.4.4版中运行良好: $(“#nome_produto”).autocomplete({ source: function( request, response ) { $.ajax({ async:false, url: “”, dataType: “json”, type: “POST”, data: request, success: function( data ) { response( $.map( data, function( item ) { return { label: item.label, value: item.label, cod: item.cod } })); }, beforeSend:function(){ $(“#nome_produto”).toggleClass(“loading”); }, complete:function(){ $(“#nome_produto”).toggleClass(“loading”); } }); }, minLenght:3 […]