The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> [jQuery] Pull Text from .txt file and insert into div
Egolfius
post Dec 27 2014, 03:00 PM
Post #1





Group: Members
Posts: 3
Joined: 25-December 14
Member No.: 21,967



Is this something I can do with jQuery? I've tried .get, but perhaps I wasn't using it correctly?

CODE

$.get( "text/" + page + "/" + i + ".txt", function( data ) {
    $("#l_col a:nth-child(" + i + ")").append("<div id='info'>" + data + "</div>");
});


I am extremely new to jquery, so the help is much appreciated.

This post has been edited by Egolfius: Dec 27 2014, 03:06 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Dec 27 2014, 04:02 PM
Post #2


.
********

Group: WDG Moderators
Posts: 9,653
Joined: 10-August 06
Member No.: 7



QUOTE(Egolfius @ Dec 27 2014, 09:00 PM) *

Is this something I can do with jQuery?

You can do it with Ajax through jQuery (which I'm not familar with), if the file is on the same domain.

QUOTE
I've tried .get, but perhaps I wasn't using it correctly?

No, that only seems to retrieve DOM elements: http://api.jquery.com/get/



User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th April 2024 - 07:42 PM