cdiego

video_11_iajax.php

Aug 28th, 2013
1,192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. <?php
  2. header('content-type: application/json; charset=utf-8');//HEADER PARA JSON
  3. include_once 'php/puntosDAO.php';
  4. $ac = isset($_POST["tipo"])?$_POST["tipo"]:"x"; //PARAMETRO PARA DETERMINAR LA ACCION
  5.  
  6. switch ($ac) {
  7.     case "grabar":
  8.         $p = new puntosDao();
  9.         $exito = $p->grabar($_POST["titulo"], $_POST["cx"], $_POST["cy"]);
  10.         if($exito)
  11.         {
  12.             $r["estado"] = "ok";
  13.             $r["mensaje"] = "Grabado Correctamente";
  14.         }
  15.         else
  16.         {
  17.             $r["estado"] = "error";
  18.             $r["mensaje"] = "error al grabar!";
  19.         }
  20.     break;
  21.  
  22.    default:
  23.         $r["estado"] = "error";
  24.         $r["mensaje"] = "datos no válidos";
  25.     break;
  26. }
  27. echo json_encode($r);//IMPRIMIR JSON
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment