Search the Community
Showing results for tags 'Jquery json ajax'.
-
Sveiki visiem, gribētu noskaidrot kā pareizi ielādēt preces aprakstu HTML <?php foreach ($clients as $item):?> <p><strong>Pasūtijuma numurs:</strong> <?=$item['client_id'];?></p> <p><strong>Vārds:</strong> <?=$item['name'];?></p> <p><strong>Uzvārds:</strong> <?=$item['last_name'];?></p> <p><strong>Telefons:</strong> <?=$item['phone'];?></p> <p><strong>E-pasts:</strong> <?=$item['email'];?></p> <p><strong>Papildinformācija:</strong><br /> <?=$item['comments'];?></p> <p><a href="#" onclick="return false" onmousedown="javascript: goodsShow('<?=$item['pots_id'];?>');">Klienta pasūtījums</a></p> <p id="goods"></p> <div style="border-bottom: 1px dashed gray; margin: 5px;"></div> <?php endforeach;?> PHP public function goodsshow() { $pots_id = $this->input->post('pots_id'); $data['goods'] = $this->admin_model->getgoods($pots_id); $c = json_encode($data); echo $c; } JS $(document).ready(function(){ });//END Ready function goodsShow (pots_id) { $.ajax({ url: "/admin/admin/goodsshow", type: "POST", data: {pots_id:pots_id}, dataType: "json", success: function(data){ alert(data); } }); } alert (data); saņem kā objektu, kā izvadīt cenu, krāsu, valsti? FireBug {"goods":{"pots_id":"2","type":"horizontal","title":"Horizont\u0101lu izeju","description":"S\u0113dpodi ar horizont\u0101lu izeju!","keywords":"S\u0113dpodi ar horizont\u0101lu izeju!","image":"pots6.jpg","company":"Gustavsberg","country":"Zviedrija","color":"Melns","material":"keramika","goods_text":"Apraksts par preci\r\n","old_prince":"160","prince":"100"}}