Hi,
I'm trying to send data on insert by javascript call; this is the code.
JavaScript Code:
1 <script>
2 $.ajax({
3 type: "POST",
4 url: "funcion.php",
5 data: { "codigo" : "codigo" },
6 success: function(data){
7 alert(data);
8 }
9 });
10 </script>
Look, this code is calling funcion.php, this:
1 <?php
2 $codigo = $_POST['codigo'];
3 $conn = oci_connect('usuario', 'password', 'dbname');
4 $query = 'SELECT NOMBRE, DEPTO FROM EMPLEADO WHERE CODIGO=' . $codigo;
5 $exec = oci_parse($conn, $query);
6 oci_execute($exec);
7 $resultado = oci_fetch_array($exec, OCI_ASSOC);
8 //manejo de excepciones y errores
9 echo $resultado;
10 ?>
My question:
¿It's possible get params from grid as Id to compare on funcion.php file as $codigo var?
Regards…
Thanks by your help Abu!
In your JS code, you can pick selected row ID or any Row data:
Returns selected row id (single row)
var selr = jQuery('#list1').jqGrid('getGridParam','selrow');
Return data of passed row and col, where invdate is column name
var rd = jQuery('#list1').jqGrid('getCell', selr, 'invdate');
You can use these vars in your ajax code.
For more api details, refer faq: Q) How can i get IDs or Data of the selected rows of grid?