Posted in Javascript, JQuery, JSON, NOTY

Javascript – Yes / No NOTY buttons

function deleteDocs () {

var uploadid = <?php echo ($uploadid); ?>;

$.noty.closeAll()

var n = noty({

text : ‘<?php echo $translation->getValue(“CESDoyouwanttoDELETEyourUPLOADEDDOCUMENTSfromthedatabase”)?>’,
type : ‘confirm’,
dismissQueue : false,
layout : ‘top’,
theme : ‘defaultTheme’,

buttons : [

{addClass: ‘btn btn-success’, text:'<?php echo (“Yes”)?>’, onClick:

function($noty) {

$noty.close();

$.post(‘inl_sev_066_J_ver.php’,{“UPLOADID” : uploadid,

“event” :’STOOR’}, function(response) {

// alert (“Javascript object – response : ” + JSON.stringify(response, null, 4));

if (response[0].success == “Y”) {

$.noty.closeAll();

var n = noty({
dismissQueue: false,
timeout : 2000,
text : response[0].message,
type : ‘success’,
layout : ‘top’
});

} else {

$.noty.closeAll();

var n = noty({
dismissQueue: false,
text : response[0].message,
type : ‘error’,
layout : ‘top’
});

}

}, ‘json’)

}

}, // YES Button

{addClass: ‘btn btn-danger’, text:'<?php echo (“No”)?>’, onClick:

function($noty) {

$noty.close();

noty({text:'<?php echo (“Cancelled”)?>’, type: ‘error’,timeout:1000});

} // “NO” Button

}

] // Noty button array

}) // Noty

}