Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript noty jQuery-通知apearence_Javascript_Jquery_Codeigniter - Fatal编程技术网

Javascript noty jQuery-通知apearence

Javascript noty jQuery-通知apearence,javascript,jquery,codeigniter,Javascript,Jquery,Codeigniter,我想在“全部删除”按钮上显示通知。我使用noty jquery,当我点击delete all按钮时,只点击通知按钮show not full and page redirected我正在使用codeigniter我在做下面的代码 // view of my file <?php $page_url = $this->uri->segment(2);?> <div id="contents" style="width:1024px;"> <di

我想在“全部删除”按钮上显示通知。我使用noty jquery,当我点击delete all按钮时,只点击通知按钮show not full and page redirected我正在使用codeigniter我在做下面的代码

// view of my file
<?php $page_url = $this->uri->segment(2);?>

<div id="contents" style="width:1024px;">

    <div class="buttons">

        <div><button class="button-choose-2 pure-button" id="delete">Delete</button></div>

        <div>
            <input type="button" class="button-choose-2 pure-button" name="CheckAll" value="Check All" onClick="checkAll(document.myform.list)"></div>
        <div>
            <input type="button" class="button-choose-2 pure-button" name="UnCheckAll" value="Uncheck All" onClick="uncheckAll(document.myform.list)"></div>

        <div><a href="parexons_con/add_team"><button class="button-choose-2 pure-button">Add</button></a></div>
    </div>

    <br style="clear:both;">
    <?php $this->load->view("includes/left_menu") ?>
    <form name="myform" id="myform">
        <div class="right-contents">
            <table width="98%" cellpadding="5">
            <tr class="right-top">
                    <td width="8%">&nbsp;</td>
                    <td width="21%">Name</td>
                    <td width="18%">Image</td>
                    <td width="38%">Designation</td>
                    <td colspan="3" align="center">Actions</td>

                </tr>

                <?php if(is_array($items)): ?>

                <?php foreach($items as $row){?>
                <tr>

                    <td width="8%"><input type="checkbox" id="list"  name="del[]" value="<?php echo $row->team_id;?>" class="del"></td>

                    <td width="21%"><?php echo $row->name?></td>

                    <td width="18%"><img src="assets/icons/<?php echo $row->photo?>" width="100" height="70"></td>

                    <td width="38%"><?php echo $row->designation?></td>

                    <td width="5%"><a href="parexons_con/edit_team/<?php echo $row->team_id; ?>"><img src="assets/img/edit.png"></a></td>

                    <td width="5%"><img src="assets/img/27935.png"></td>

                    <td width="5%"><a href="parexons_con/delete/<?php echo 
$row->team_id;?>/<?php echo $page_url ?>/<?php echo 'team'; ?>/<?php echo 'team_id'; ?>"><img src="assets/img/Delete-icon.png"></a></td>
                </tr>

                <?php } endif; ?>
            </table>
        </div>
</form>

    <script>
        function checkAll(field)
        {
            for (i = 0; i < field.length; i++)
                field[i].checked = true ;
        }

        function uncheckAll(field)
        {
            for (i = 0; i < field.length; i++)
                field[i].checked = false ;
        }
    </script>
</div>

</div>
<script type="text/javascript">

    $(document).ready(function(){

        $("#delete").on('click', function(e) {
            var r =  confirm("are you sure you want to delete this");

            if (r==true) {
                e.preventDefault();

                var ids = $('.del:checked').map(function () {
                    return this.value;

                }).get();
                console.log(ids);

                $.ajax({
                    type: "POST",
                    url: "<?php echo base_url(); ?>parexons_con/delete_all",

                    data: 'id=' + ids,
                    type: "POST",


                    success: function (result) {


                        noty({text: 'thank you for providing information', type: 'success',settimeout:5000});


                        setTimeout(window.location.reload(), 1200000);

                    }
                });
            }
            });
    });



</script>

jqueryajax数据的语法错误

data: {id: ids},
其次,不要重定向控制器函数,您需要向ajax成功传递一些值,如

function delete_all($del_id = NULL, $view = NULL, $table = NULL, $field_name = NULL) {
$error = 'error';
$msg = 'deleted';
$ids = $this->input->post('id');
$explode = explode(",", $ids);
foreach ($explode as $id) {
    $query = $this->parexons_model->delete_row('team', array('team_id' => $id));

}
if ($query) {
   echo "success";
} else {
   echo "false";
}
}

检查控制台是否有js错误,settimeout应该是settimeout。感谢saty Soooo,我做了很多尝试,它认为跳转结果会更好
function delete_all($del_id = NULL, $view = NULL, $table = NULL, $field_name = NULL) {
$error = 'error';
$msg = 'deleted';
$ids = $this->input->post('id');
$explode = explode(",", $ids);
foreach ($explode as $id) {
    $query = $this->parexons_model->delete_row('team', array('team_id' => $id));

}
if ($query) {
   echo "success";
} else {
   echo "false";
}
}