Front-end

"data" is $response from the backend

$.ajax({
  url: 'update_table.php',
  type: 'post',
  data: {table: table_arr, task: task_arr, check: check_arr, id: count},
  datatype: 'json',
    success: function(data){
      alert(data);
      if(data['status']=='success'){
      alert('success');
      }
      else {
        alert('failed');
      }
    }
});

Back-end

$sqlstat_1 ~ 3 : return values of query executions;

$sqlstmt_3 = $stmt->execute();
if($sqlstat_1 & $sqlstat_2 & $sqlstat_3) {
  $response = array(
      'status' => 'success',
  );  
}
else{
  $response = array(
    'status' => 'failed',
);
}

echo(json_encode($response));
exit();

results matching ""

    No results matching ""