jQuery – text 파일 불러오기
April 14th, 2013
No comments
jQuery를 이용하여 사용자가 원하는 파일을 불러올수 있습니다.
원하는 위치에 아래를 추가합니다.
| HTML | | copy code | | ? |
해당 파일을 불러오면 됩니다.
| Javascript | | copy code | | ? |
| 1 | <script type="text/javascript"> |
| 2 | $(function(){ |
| 3 | $( "#target" ).load( "example.txt" ); |
| 4 | }); |
| 5 | </script> |
- 적용 예
| HTML | | copy code | | ? |
| 01 | <!DOCTYPE html> |
| 02 | <html> |
| 03 | <head> |
| 04 | <title>jquery example</title> |
| 05 | <meta charset="UTF-8"> |
| 06 | <meta name="description" content="jquery example"> |
| 07 | <script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script> |
| 08 | </head> |
| 09 | |
| 10 | <body> |
| 11 | <script type="text/javascript"> |
| 12 | $(function(){ |
| 13 | $( "#target" ).load( "example.txt" ); |
| 14 | }); |
| 15 | </script> |
| 16 | |
| 17 | <pre> |
| 18 | <div id="target"></div> |
| 19 | </pre> |
| 20 | |
| 21 | </body> |
| 22 | </html> |
Categories: jquery jQuery, jQuery load, jQuery load txt file, jQuery text, jQuery text 파일, jQuery txt
Recent Comments