read a text file and show its data in text box

<>

This question already has an answer here:

Answers


You can use an http request to do it and get the file as a static page.

function exec_req(url)
{
objAJAX = false;
if (window.XMLHttpRequest)
{
    try
    {
        objAJAX = new XMLHttpRequest();
        if (objAJAX.overrideMimeType) objAJAX.overrideMimeType('text/xml');
    }
    catch(e) 
    {
        objAJAX = false;
    }
}
else if (window.ActiveXObject)
{
    try 
    {
        objAJAX = new ActiveXObject("Msxml2.XMLHTTP");
    } 
    catch(e) 
    {
        try 
        {
            objAJAX = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(e)
        {
            objAJAX = false;
        }
    }
}

if (objAJAX)
{

  objAJAX.onreadystatechange = myCallback;  
}
    objAJAX.open("GET", url, true);
    objAJAX.send();
}
}

 function myCallback() {

   if(objAJAX.readyState == 4 && objAJAX.status == 200) {   

    var myText = objAJAX.responseText
        alert(myText)

    }

    else {alert('error while reading this file');}

     }

just call the function exec_req('bla/your_file _link.txt'), and when the file'll be read the function myCallback will be invoked, and the text you are looking for will be available as a local var in that function. This is async. I am not sure it will work locally if you don't run a localhost (Cross origin requests are only supported for HTTP).


Need Your Help

Updating columns in php ?

php mysql mysqli

I apologise if I’m asking this question wrong I’m new to stackoverflow and to php.

Playing .mp4 file in android programatically from dropbox or googledrive

google-drive-api android-mediaplayer dropbox-api

Is it possible to call and play .mp4 file in android programatically from dropbox or googledrive?