Jump to content
php.lv forumi
  • 0

Ielādēt preces sarakstu


vostro

Question

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"}}

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...