volosoft / jtable

A JQuery plugin to create AJAX based CRUD tables.
http://www.jtable.org
1.1k stars 506 forks source link

Controlar errores $jTableResult['Result'] #2274

Open cogare84 opened 2 years ago

cogare84 commented 2 years ago

Hola. Quisiera saber como puedo controlar cuando da algún error la carga del objeto jtable. El caso es que si se produce un error en el controlador, hago lo siguiente: $jTableResult['Result'] ='error'; pero luego como puedo controlar dicho resultado en la parte donde cargo el div que contiene el objeto jtable? Gracias de antemano y un saludo.

misterparsons commented 2 years ago

Hello,

Jtable processes the server response for you.

If there is an infrastructure problem there will be an HTTP failure, or if jtable does not recognise the response, jtable will show an Alert with "An error occured while communicating to the server."

If your controller completes normally, but recognises it cannot perform the jtable request, it must return a json response {"Result":"ERROR","Message":"your message to your user"}

JTable will then show this message in an Alert box

Note. ERROR must be uppercase.

Goog Luck