Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
Unable to Read Data From Jquery.Get()

I created a Node Server and app.get('/links') route to grab entire image list. On FrondEnd I'm using standard HTML file with vanilla JavaScript and only $.get() JQuery function. Function perfectly loading data in console but for some reason I'm unable to use this data outside of $.get(). How can i read this data in standard JS Script embeded in HTML? FrontEnd Script Embeded in HTML Code

$.get('/links', (data) => {
            loaddata(data);
        })
    let allImages= []
    let firstImg = ''
    let lastImg = ''
    let totalImgs = 0
    let currentImgIndex = 0    
    function loaddata(inpArr){
        totalImgs = inpArr.length
        firstImg = inpArr[0]
        firstImg = inpArr[totalImgs-1]
        allImages = inpArr
    }

NodeJs Route

var express = require('express')
var fs = require('fs');
var array = fs.readFileSync('links.txt').toString().replace(/\r\n/g,'\n').split("\n");
for(i in array) {
    console.log(array[i]);
}
app = express()

app.use(express.static(__dirname))

app.get('/links', (req, res) => {
    res.send(array)
})

app.listen(3000)

Links File

9th-Chem-2013-G1-011
9th-chem-ch-05-02
9th-chem-ch-05-03
9th-chem-ch-05-04
9th-chem-ch-05-05
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!