Update file *.json in device for * file. json in server


#1

Is it possible to make the download of a file to the Web application folder? or update an existing one already? I in phonegap, but got in ionic’m not getting, is that someone could give me some lights? I’ve been searching for, and implemented some code, but it is not working, I already know it’s asking a lot, but some could help me and say you have something wrong or if a problem and even Cross-origin even I having already added this permição the xmlfile.

var fname="......./eventos.json";
    var xhr=false;
     try {
            xhr = new ActiveXObject('Msxml2.XMLHTTP');
        }
        catch (err2) {
            try {
                xhr = new ActiveXObject('Microsoft.XMLHTTP');
            }
            catch (err3) {
    	try {
    		xhr = new XMLHttpRequest();
    	}
    	catch (err1) 
    	{
    		xhr = false;
    	}
            }
        }
    xhr.open("GET", fname,true);
    xhr.onreadystatechange=function() 
    	{
    		if (xhr.readyState == 4) 
    		{
    			if (xhr.status != 404) 
    			{
    				
    				ole=eval("(" + xhr.responseText + ")");
    				
    			} 
    			else 
    			{
    				alert(" not found");
    			}
    		}
    		
    		
    	}
    	
    xhr.send(null); 

Thankful for lost time to read this post thanks