Skip to content
Advertisement

Displaying an Alertbox from PHP Controller class

Currently I’m in my controller and I have placed a check in the controller. Basically checking if the value of a particular field is 0 or not. Now if it is 0, I want to display an alert popup via my controller. To do this I’ve tried the following code:

JavaScript

Now it is entering my if condition, but it doesnt show me the popup.

This is the AJAX call I’m making to enable this function:

JavaScript

Another thing I’ve tried here is using json_encode this way:

JavaScript

But this also didn’t give back any response.

Advertisement

Answer

If the function in your controller works well, then you need append your result from server to your DOM:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement