send form data on insert

Questionssend form data on insert
C3media asked 9 years ago

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!

2 Answers
Abu Ghufran answered 9 years ago

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?

C3media answered 9 years ago

Thanks Abu,

Resolved with other method!

Regards…!

Your Answer

1 + 17 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?