MySQL Forums
Forum List  »  PHP

Displaying an Alertbox from PHP Controller class
Posted by: Jay Modi
Date: January 29, 2022 05:21AM

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:

public function status($status){
foreach($this->input->post('id') as $key => $id):
$check_emirate = $this->listings_model->check_emirate($id);
if($check_emirate->emirate == 0){
echo "<script>alert('This card was not approved.');</script>";
$data=array('status'=>$status); $updated=$this->listings_model->update($data,array(),$id);
return true;

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:

$(".status").click(function(e) { chagestatus($(this)); }

function chagestatus(obj){
if($('.chkbx').is(':checked') == true){
type: "post",
dataType: "json",
url: "<?php echo site_url('listings/status'); ?>/"'val'),
data: $(".chkbx:checked").serialize(),
success: function(result) {}

Options: ReplyQuote

Written By
Displaying an Alertbox from PHP Controller class
January 29, 2022 05:21AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.