How to call javascript function on_after_insert?

QuestionsHow to call javascript function on_after_insert?
dianabf asked 8 months ago

How to call a javascript function on on_after_insert event, something like this: 
$e[“on_after_insert”] = array(“after_insert”, null, false);
$g->set_events($e);
function after_insert($data){
global $g;
$consulta = ” SELECT *
FROM inventario_produccion.prueba_articulos_areas
WHERE codigo_articulo = {$data[“params”][“codigo_articulo”]}
and id_area ={$data[“params”][“id_area”]}”;

$ejecutar = mysql_query($consulta);
$row = mysql_fetch_array($ejecutar);
$existencia = $row[“existencia”];
$cantidad = $data[“params”][“cantidad”];
$resta = $existencia – $cantidad;
$g->execute_query(“UPDATE inventario_produccion.prueba_articulos_areas SET existencia = “.$resta. “
//WHERE codigo_articulo = {$data[“params”][“codigo_articulo”]} and id_area = {$data[“params”][“id_area”]}”);

$codigo_articuloD = $data[“params”][“codigo_articulo”];
$areaD = $data[“params”][“id_area”];
echo(‘<script type=”text/javascript”>correo_salidas(‘.$areaD.’, ‘.$codigo_articuloD.’, ‘.$resta.’);</script>’);

}

dianabf replied 8 months ago

P.S the javascript function make a ajax call

3 Answers
Abu Ghufran Staff answered 7 months ago

You can replace last echo line with:
phpgrid_msg(“Record Saved<script>alert(123);</script>”,1);

_________________________
Abu Ghufran - Dev Team
PHP Grid Framework
 
dianabf replied 7 months ago

sorry, but where I supposed to see the message? because I cant see it

dianabf answered 7 months ago

I try yo do that,but it doesnt work,another idea

Abu Ghufran Staff answered 7 months ago

Emailed you working demo.

_________________________
Abu Ghufran - Dev Team
PHP Grid Framework
 
dianabf replied 7 months ago

I sent you my work, thanks

Your Answer

3 + 7 =

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:

As you found this post useful...

Follow us on social media!

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

Let us improve this post!