I have the following situation, I am using a $. ajax POST to send data to the server but I have a detail, when I load the site in a Safari browser either in a Mac or in a Ipad the process does not run to me and it keeps loading in:
beforeSend: function(){
message = $("<div class='alert alert-danger'><span class='before'>Subiendo, por favor espere...</span></div>");
showMessage(message)
}
Searching in internet I found a similar problem, in which they only had to add the following lines:
async: true,
headers: {
"cache-control": "no-cache"
},
I added them but the problem is not solved. Then I leave the code to see if you can help me.
Note: It does not generate any errors in the development console of Safari .
Thanks.
$.ajax({
type: "POST",
url: "index.php",
data: dataString,
cache: false,
contentType: false,
processData: false,
async: true,
headers: {
"cache-control": "no-cache"
},
//mientras enviamos el archivo
beforeSend: function(){
message = $("<div class='alert alert-danger'><span class='before'>Subiendo, por favor espere...</span></div>");
showMessage(message)
},
success: function (datos) {
if(!id){
$("input#idnombre").val("");
$("textarea#idatalle").val("");
$('select#grupo').prop('selectedIndex',-1);
$('select#id_usuario').prop('selectedIndex',-1);
}
//$("textarea#idatalle").val("");
$("div#iderror").html(datos);
},
//si ha ocurrido un error
error: function(){
message = $('<div class="alert alert-danger">Ha ocurrido un error.</div>');
$( "#accion" ).prop( "disabled", false );
showMessage(message);
}
});