![](/img/trans.png)
[英]I want to make notification using ajax laravel when I click “Add To Chart” and the notification is Success or failed
[英]Codeigniter when i click delete i want pop up notification if if click yes or not
模型:
function delete_exchange($ExchangeRateId) {
$this -> db -> where('ExchangeRateId', $ExchangeRateId);
$this -> db -> delete('exchange_rate');
}
控制器:
function delete($ExchangeRateId) {
$user_type = $this -> session -> userdata('user_type');
if ($user_type != "admin") {
redirect(base_url() . 'user_admin/login');
}
$this -> all -> delete_exchange($ExchangeRateId);
redirect(base_url() . 'exchange/index');
}
刪除按鈕很清楚,在這里我想要一個通知,比如彈出是或者必須運行我的意思是刪除的操作
在視圖頁面
<script>
function doconfirm()
{
job=confirm("Are you sure to delete permanently?");
if(job!=true)
{
return false;
}
}
</script>
刪除鏈接
<a href="<?php echo site_url();?>/mycontroller/delete/<?php print($data->auc_id);?>">
<img src='images/delete.gif' title="Delete" onClick="return doconfirm();" >
</a>
在你看來這樣做..
<a href="<?PHP site_url('delete/').$ExchangeRateId;?>" onclick="return deletechecked();">delete<?a>
function deletechecked()
{
if(confirm("Delete selected messages ?"))
{
return true;
}
else
{
return false;
}
}
你需要做那個客戶端......在你看來......你想要構造的按鈕的onclick事件使用confirm()
......
將此添加到您的按鈕..
<button onclick="confirmation()" />
function confirmation()
{
var r=confirm("are you sure to delete?")
if (r==true)
{
alert("pressed OK!")
// call the controller
}
else
{
alert("pressed Cancel!");
return false;
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.