Send Grid ID on click event by JavaScript Function

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

Hi Community,

I have this code:

1) Html Form:

<html>
<head>
<title>Function AJAX</title>
<script type="text/javascript" src="/js/jquery.js"></script>
<script>
function realizaProceso(valorCaja1, valorCaja2){
var parametros = {
"valorCaja1" : valorCaja1,
"valorCaja2" : valorCaja2
};
$.ajax({
data: parametros,
url: 'procesar.php',
type: 'post',
beforeSend: function () {
$("#resultado").html("Procesando, espere por favor…");
},
success: function (response) {
$("#resultado").html(response);
}
});
}
</script>
</head>
<body>
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"/>
<br/>
Resultado: <span id="resultado">0</span>
</body>
</html>

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

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

Thanks

1 Answers
Abu Ghufran answered 8 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 + 19 =

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?