TvMiller Posted August 2, 2012 Share Posted August 2, 2012 I need some help with search keywords to find what I need for this to work. I have a php script (page) writing a xml file or txt file (either which works for this scenario)http://tvmiller.com/ocext/popup.phpThe page produces a single line in either xml or txt to advise of an alert. I'm trying to learn how to then create a javascript (or other html friendly i.e. non-php) script that will read the xml or txt file and if/else based on the one line in the file. Please give me some clues so I can learn more around the net to figure this out...or I welcome alternative tactics. Thanks! Link to comment Share on other sites More sharing options...
JamesB Posted August 13, 2012 Share Posted August 13, 2012 If your wanting JavaScript to fetch the contents of a xml or txt file which is on the server, you can use AJAX inside JavaScript. var ajax = new XMLHttpRequest; ajax.onreadystatechange = function() { if (ajax.readyState == 4) { alert(ajax.responseText); }} ajax.open('GET', 'path/to/some_file.txt', true);ajax.send(); http://www.w3schools...equest_send.asp Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now