Skip to content

Commit

Permalink
🔨 APP #275 melhorando exemplo
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Sep 23, 2022
1 parent 21fd280 commit 60a8550
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
6 changes: 3 additions & 3 deletions appexemplo_v1.0/modulos/tree/exe_tree_view_6_check.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@
$frm->show();
?>
<script>
function treeCheck(id, state){
function treeCheck(id, checked){
alert( state );
jQuery.ajax({
type: "POST"
,url: "includes/treeview_salvar_check.php"
,data: "id="+id+'&checked='+state
,url: "treeview_salvar_check.php"
,data: "id="+id+'&checked='+checked
,success: function(msg){
msg = jQuery.trim(msg);
if( msg ){
Expand Down
30 changes: 30 additions & 0 deletions appexemplo_v1.0/treeview_salvar_check.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/****
* Arquivo utilizado pelo arquivo exe_tree_view_6_check.php
* para gravar o valor check ou não da treeview
****/
header('Content-Type: application/json; charset=utf-8');

require_once 'includes/constantes.php';
require_once 'includes/config_conexao.php';
require_once '../base/classes/webform/TApplication.class.php'; //FormDin 5

try{
//var_dump($_REQUEST);
$id = $_REQUEST['id'];
$checked = $_REQUEST['checked'];
$checked = ($checked==1)?'S':'N';

if ( !isset($id) ) {
$data = "Id não informado";
echo json_encode($data);
} else {
$arrParams = array($checked,$id);
$sql = "UPDATE treecheck_link SET checked = ? WHERE id = ?";
$dados = TPDOConnection::executeSql($sql, $arrParams);
echo json_encode($dados);
}
} catch (Exception $e) {
$msg = 'Exceção capturada: '.$e->getMessage();
echo json_encode($data);
}

0 comments on commit 60a8550

Please sign in to comment.