Send Grid ID on click event by JavaScript Function

QuestionsSend Grid ID on click event by JavaScript Function
C3media asked 4 years ago

Hi Community,

I have this code:

1) Html Form:

<title>Function AJAX</title>
<script type="text/javascript" src="/js/jquery.js"></script>
function realizaProceso(valorCaja1, valorCaja2){
var parametros = {
"valorCaja1" : valorCaja1,
"valorCaja2" : valorCaja2
data: parametros,
url: 'procesar.php',
type: 'post',
beforeSend: function () {
$("#resultado").html("Procesando, espere por favor…");
success: function (response) {
Introduce valor 1
<input type="text" name="caja_texto" id="valor1" value="0"/>
Introduce valor 2
<input type="text" name="caja_texto" id="valor2" value="0"/>
Realiza suma
<input type="button" href="javascript:;" onclick="realizaProceso($('#valor1').val(), $('#valor2').val());return false;" value="Calcula"/>
Resultado: <span id="resultado">0</span>

2) procesar.php:
$resultado = $_POST['valorCaja1'] + $_POST['valorCaja2'];
echo $resultado;

I Would like to send ID grid as parameter to procesar.php, Somebody know do that?


1 Answers
Abu Ghufran answered 4 years ago

If you mean ID of selected row of grid, then:

var rowid = jQuery('#list1').jqGrid('getGridParam','selrow');

Where list1 is grid id.

Your Answer

18 + 1 =

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 / 5. Vote count:

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

Let us improve this post!