How to call javascript function on_after_insert?

QuestionsHow to call javascript function on_after_insert?
dianabf asked 6 years 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 6 years ago

P.S the javascript function make a ajax call

5 Answers
Abu Ghufran Staff answered 6 years ago

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

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
dianabf replied 6 years ago

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

dianabf answered 6 years ago

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

Abu Ghufran Staff answered 6 years ago

Emailed you working demo.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
dianabf replied 6 years ago

I sent you my work, thanks

Jorge answered 5 years ago

I’d like to see that working demo.

 

Abu Ghufran Staff answered 5 years ago
_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

10 + 3 =

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?