Help create jquery album
Help create jquery album
I make jQuery but I have not seen jquery
it is my customController
- public function actionGetgallery()
- {
- $usersId = isset($_POST['usersId'])?$_POST['usersId']:'';
- Yii::app()->user->setState('dash_usersId', $usersId);
- echo json_encode('yes');
- return;
- }
- public function actionGetImage()
- {
- $sql = ' SELECT a.picture AS picture, c.username, e.name FROM activity a JOIN usersorganization b ';
- $sql .= 'ON a.users_organization_id = b.users_organization_id ';
- $sql .= 'JOIN users c ON b.users_id = c.users_id ';
- $sql .= 'JOIN clientorganization d ON b.client_organization_id = d.client_organization_id ';
- $sql .= ' JOIN organization e ON d.organization_id = e.organization_id ORDER BY activity_id DESC';
- // $sql =' SELECT a.picture AS picture, d.name AS name FROM activity a JOIN usersorganization b ON a.users_organization_id = b.users_organization_id JOIN clientorganization c ON b.client_organization_id = c.client_organization_id JOIN organization d ON c.organization_id = d.organization_id ORDER BY activity_id DESC ';
- $dataProvider = new CSqlDataProvider(
- $sql,array(
- 'keyField' => 'picture',
- )
- );
- foreach($dataProvider->getData() AS $i=>$ii)
- // echo var_dump($ii);
- {
- $gambar = array();
- echo '<div class="superbox-list img1"><table border="2" color="black">
- <tr>
- <td><img class="superbox-img" src="'.$gambar[$i] = (int)$ii['picture'].'"/></td></tr><center>
- <tr><td><h5>'.$gambar[$i] = (int)$ii['name'].'</center></h5></td></tr></table>
- </div>';
- }
- echo json_encode($gambar);
- return;
- }
and this my views
- <script type="text/javascript">
- var Imgx = $("#image").val();
- $(document).ready(function()
- {
- getImgx();
- });
- function setProgr()
- {
- var e = document.getElementById("users_id");
- var usersId = e.options[e.selectedIndex].value;
- var uri = '<?php
- echo Yii::app()->createAbsoluteUrl("Custom/Getgallery");
- ?>';
- jQuery.ajax(
- {
- type: 'POST',
- async: false,
- dataType: "json",
- url: uri,
- data: {usersId:usersId},
- success: function(result)
- {
- getImgx();
- // alert(getImgx);
- }
- });
- }
- function getImgx()
- {
- var e = document.getElementById("users_id");
- var usersId = e.options[e.selectedIndex].value;
- var uri = '<?php echo Yii::app()->createAbsoluteUrl("Custom/GetImage"); ?>';
- jQuery.ajax(
- {
- type: 'POST',
- async: false,
- dataType: "json",
- url: uri,
- data: {usersId:usersId},
- success: function(result)
- {
- alert(Imgx);
- Imgx = result;
- }
- });
- }
- </script>