Firefox ajax network error

cancel
Showing results for 
Search instead for 
Did you mean: 
waqas123
Member II

Firefox ajax network error

Hi,

     I am Web developer, i m using  Alfresco API and uploading file to the directory using the ajax call which is working fine for all the browsers except  Mozilla Firefox (all versions), It is  throwing a network error which states
 
"Network Error: A Network error occurred"
 and stops the script  resulting failure in  uploading functionality. I have tried many workarounds but unable to resolve this issue. Please confirm is there any restriction on your end  for browsers specifically Mozilla . Also if i m doing any wrong in calling ajax on Firefox which is causing error  response from your server please guide me with any example could really appreciate. 
2 Replies
krutik_jayswal
Senior Member II

Re: Firefox ajax network error

Please add code for the same.

waqas123
Member II

Re: Firefox ajax network error

the code is below which is working fine on all browsers except the Firefox

function check_form(formname) {

window.onbeforeunload = null;

var folderName = document.getElementById('name').value;

var getUrl = window.location;
var baseUrl = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];

var data;
$.ajax({
type: 'POST',
url: baseUrl +'/index.php?entryPoint=customEntryPointAlfrescoConfig',
data:
{
alfresco_foldername: folderName,
},
cache: false,
success: function(html){
data = html;
callAlfresco(data);
},
error: function(xhr,status,error) {
alert('Error!');
}
});

return true;
}

function callAlfresco(data){


var protocol = location.protocol;
var res = data.split("/");

var alfrescoLogin = res[0];
var alfrescoPassword = res[1];

var alfrescoNodeId = res[5];
var alfrescoTicketId = res[6];
var d = new Date();
var alfrescoBaseUrl = res[2]+":"+res[3];

var uploadName = 'File_Time' + d.getTime();
var uploadFiles = document.getElementById('filename_file').files;

var form = new FormData();
form.append('name', uploadName);
form.append('nodeType', 'cm:content');
form.append('filedata', uploadFiles[0]);

$.ajax({
username: alfrescoLogin,
password: alfrescoPassword,
url: protocol+'//'+alfrescoBaseUrl + '/alfresco/api/-default-/public/alfresco/versions/1/nodes/'+alfrescoNodeId+'/children?alf_ticket='+alfrescoTicketId,
method: 'POST',
mimeType: 'multipart/form-data',
data: form,
async: true,
crossDomain: true,
processData: false,
contentType: false,
success: function(result,status,xhr) {
alert('Sucess!');
// $('#go-button').click();
},
error: function(xhr,status,error) {
alert('Error!');
}

});

}