Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8157153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:11:01+00:00 2026-06-06T17:11:01+00:00

So I have a simple setup going here where I load up a file

  • 0

So I have a simple setup going here where I load up a file (A blender .obj file) and display it. Then I call this function:

function parseFile(){
        var fileText = $('#file').html();
        var fileLine = fileText.split("\r\n");
        $('#file').html(fileLine[5]);
    }

Which should make it so it displays the 6th line of the file, but it still displays the whole file. How do I make it split the lines like they are in the actual file?

Edit: Just so everyone know’s I’m loading the file like this: $('#file').load('model.obj');

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:11:03+00:00Added an answer on June 6, 2026 at 5:11 pm

    The call to .load() is asynchronous. The method will return, but the content will be available somewhen in the future. You’ll need to use a callback:

    $('#file').load('model.obj', function(response, status) {
        alert("Now the file is loaded");
        parseFile();
    });
    alert("Loading the file just began, nothing available by now");
    

    Or more narrative, using the deferred interface:

    $('#file').load('model.obj').then(parseFile);
    

    If you need/want to parse the server response anyway, it might be a better to use $.ajax() directly instead of loading it into a innerHTML and reading from there… You even could use a dedicated dataFilter for the blender.obj file type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple thing going here: two divs and two calls to load
If I have a simple class setup like this: class MyClass { private string
Trying to setup a simple Thread/Poll table mapping. Here is what I have: Threads
I have a simple setup, where there are Products and Images. Products have many
I have a very simple Setup project that copies three dlls into the GAC.
I have a simple inno-setup script that allows my setup to install either the
I have a simple client/server setup. The server is in C and the client
I have setup some simple associations in my rails app: resources :properties do resources
I have a very simple ColorBox gallery setup just like the examples. Simple tags
I want to setup a simple site and I don't have any web development

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.