1
This running just updating the site, would only be used when clicking on the link, someone could help me?
<a id="acceptButton" class="btn btn-success btn-block" data-value="<?php echo utf8_encode($array['folio_number']); ?>">Aceptar <i class="fa fa-check"></i></a>
<script type="text/javascript">
$(document).ready(function() {
$(document).on("click", ".btn-success", function(e) {
e.preventDefault();
var value_id = $(this).data('value');
jQuery.ajax({
type: "POST",
data: { input_value : value_id },
success: function(data,status,xhr) {
// Check the output of ajax call on firebug console
console.log(data);
<?php
$update = $datasource->acceptNewCustomer($user_id,1,utf8_decode($_POST['input_value']));
if ($update == 'OK') {
?>
alert('Cliente agregado correctamente');
location.reload();
<?php
}
else {
?>
alert('Error al agregar cliente');
<?php
}
?>
},
error: function () {
alert("error");
}
});
});
</script>
Do you want to define at page loading time what is the result of AJAX? If not, if you just want to set on the return of the webservice, then your php code is in the wrong corner
– Jefferson Quesado