jquery - How to show single data in popup window by clcking id using codeigniter with database -


i want show single record clicking button id using codeigniter mysql. when clicking button ajax not working.

views:

   <div class="demo1">        <input type="hidden" id="porder" name="porder" value="<?php echo $result->po_id  ?>">       <input id="btnsubmit1" type="button" name="btnsubmit" value="release"/>     </div> 

ajax code:

      $('.demo1').click(function(){      var po_ids = $('#porder').val();        alert(po_ids);       $.ajax({      type: "get",     url: "view_single_temp",     cache: false,     data: 'po_id='+po_ids,     datatype: "html",            success: function(htmldata) {     }     }); 

this controller code:

public function view_single_temp() {

 echo $po_id = $this->uri->segment(3);   $details = $this->inventory_m->getpo_single($po_id);   print_r($details);   if( $item_id = $this->inventory_m->getpo_single($po_id)){    //print_r($item_id);          foreach ($item_id $item_ids) {                echo $item_number = $item_ids->item_id;               echo  $quantity = $item_ids->quantity_purchased;              echo "<br>";              echo  $name = $item_ids->item_name;               echo  $cost_price = $item_ids->item_cost_price;               echo  $sales = $item_ids->total;                echo "<br>";              }          }  

this model code:

     function getpo_single($po_id) //purchase order list display function       {     $this->db->select('*');     $this->db->from('bgs_po_list_items t1');     $this->db->where('t1.po_id', $po_id);     $query = $this->db->get();      return $query->result();  } 

my pbm: ajax not working. want data , bind in ajax..

change onclick on button. make correction in url.

 $('#btnsubmit1').click(function(){    var po_ids = $('#porder').val();    alert(po_ids);    $.ajax({     type: "get",     url: "<?php echo base_url().'controllername/view_single_temp' ?>",     cache: false,     data: {po_id : po_ids},     datatype: "html",     success: function(htmldata) {     } }); 

in controller function:

 $this->input->get('po_id');   //to value of po_id. 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -