/    Sign up×
Community /Pin to ProfileBookmark

Problem issued at work

I was tasked to create a javascript function that pulls a CSV from
crossdomain, and tests the image urls to make sure they’re valid,
I’ve already written the testing functions, but am having trouble
finding any info on pulling, formatting, and parsing CSV files. Is
there anyone here that’s had experience with this type of cross
domain stuff before?

here’s the code I’m going to use for validation, might help someone,
might not. It writes and removes tags on comparison of file sizes and
if the sizes match (404 image), reiterates to the next.

[code]
}

function pImg() {
var str = new String();
document.getElementById(“isMissing”).innerHTML= “”;
str = document.ModReg.file1.value;

if(str != “”) {
str = “<p>” + str + “</p>”;
document.getElementById(“isMissing”).innerHTML= str;

if(checkSize()) {
document.write(“<b style=’color:red;’>Missing: </b>” +fileName+ “:” +sku+);
document.getElementById(“isMissing”).innerHTML= “”;
}
}
}

function checkSize() {
var i;
var x = document.images;
for (i=0;i<x.length;i++) {
if((x[i].id) == ‘List’) {
if(x[i].fileSize == 37198)
return true;
}
}
return false;
}
</script>
[/code]

CSV file I will be pulling is located outside the domain here.
[url]http://feedpull.godatafeed.com/product.aspx?spud=4HQdUqLqR05943LbmAh%2b%2bIoM%2btPmtGWVEB4sF672EO8%3d[/url]

I thought about trying something like this, but I think browser
restrictions will stop me.

[code]
unction connect() {
var client = new XMLHttpRequest();
client.onreadystatechange = handler;
client.open(“GET”, “somedomain/feed.csv”);
}
[/code]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @ehime spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...