gromstone Posted November 8, 2012 Share Posted November 8, 2012 I am looking for suggestions and code samples to get a file and load it into a text area. Let me give a bit more of a detail. My code searches for a file, and with in that file there is a array for additional CSS files. I am looking for a way to get the CSS file to be loaded to a text-area once you click on a button. Every file contains this: $CSS = array(file.css); Now, how can I get: <a href="file.css">CSS</a> or <button onclick="myFunction()">CSS</button> To load here: <textarea id="filecontent" name="filecontent" cols="80" rows="10">".$filecontent."</textarea> Quote Link to comment https://forums.phpfreaks.com/topic/270456-load-cssjs-file-to-textbox-from-a-link/ Share on other sites More sharing options...
JD* Posted November 9, 2012 Share Posted November 9, 2012 If you don't want the page to reload, you'll need to use some javascript to make an ajax request. It would go something like this: On click, make an ajax request to a php file with the "href" of the link In the PHP file, open the requested file and read the contents. Return the requested array, which the ajax handler will be listening for Update the text area with the return. Sound like what you're looking for? Quote Link to comment https://forums.phpfreaks.com/topic/270456-load-cssjs-file-to-textbox-from-a-link/#findComment-1391329 Share on other sites More sharing options...
AyKay47 Posted November 10, 2012 Share Posted November 10, 2012 To point you in the right direction, look into using jQuery's AJAX API Quote Link to comment https://forums.phpfreaks.com/topic/270456-load-cssjs-file-to-textbox-from-a-link/#findComment-1391433 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.