如何调用动作whitout重装页面,我需要删除一些行

时间:2015-06-28 15:01:04

标签: php model-view-controller frameworks

public function populateImageGrid(){

    $html = '';
    $result = $this->_db->select('
        SELECT m.*
        FROM '.$this->_table.' as m order by id desc'
    );

    if($result == true) {
        foreach($result as $row) {

            $parse = explode('/',$row['title']);
            list($width, $height, $type, $attr) = getimagesize(substr($row['title'],1));    

            $html= $html.'
            <div class="image_item" >
                <img class="hvr-ripple-out" src="'.$row["title"].'"  />

                <div class="image_item_desc">
                    <h5><span style="color: rgb(49, 157, 181);"><b>Naziv slike:</b></span>  '.ucfirst($parse[3]).'</h5>
                    <h5><span style="color: rgb(49, 157, 181);"><b>Relativna adresa slike:</b></span>  '.$row["title"].'</h5>
                    <h5><span style="color: rgb(49, 157, 181);"><b>Originalne dimenzije slike:</b></span> width: '.$width.'px,   height: '.$height.'px</h5>
                    <a href="#" onclick="deleteImage('.$row["id"].')" class="btn btn-primary"><i class="icon-trash"></i> Izbriši</a>
                </div>
                <div class="image_action"></div>
            </div>';

        }
        return $html;
    }
}

这是在apphp框架中编写的代码。 这是我用我的图像填充视图的功能,我需要添加删除图像的功能,但不需要重新加载。 我想在我的按钮中添加动作删除并在不重新加载页面的情况下执行该操作。

1 个答案:

答案 0 :(得分:0)

如果你想从网页上删除图像(来自html),jQuery就是你要找的东西。