Help: Get data from url and write to table

Hi everyone,

First, I am not a programmer so be gentile. I need some help getting data from a url and placing it into a table. I am trying to get the daily threshold securities list that is published daily on the nasdaq site. The data published today is for yesterday's threshold securities. The url changes everyday according to the date eg: The script that I managed to hack together does get the correct url everyday, but I am unable to insert the data into a dynamically created table. Here is what I have so far:
[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "">


//create the Cross-browser XMLHttpRequest object
function getFile(pURL,pFunc) {
if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc
xmlhttp=new XMLHttpRequest();
eval('xmlhttp.onreadystatechange='+pFunc+';');"GET", pURL, true); // leave true for Gecko
} else if (window.ActiveXObject) { //IE
xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
if (xmlhttp) {
eval('xmlhttp.onreadystatechange='+pFunc+';');'GET', pURL, false);


function makeTable() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) {
var tmpArr=xmlhttp.responseText.split('
var out='';
var tmp;
var val;
var txt;
var strText;
for (var idx=0;idx'+tmpArr[idx]+'';*/
strText= '';
for (var intTmp=0;intTmp'+txt+'';
if (intTmp'+txt+'';
txt = tmp[intTmp].replace('"','')
strText= strText + '';
out += strText + '';
out += '


function getFileUrl(){
/*First, get the current date*/
var currentTime = new Date();

/*because shoLists are published only at midnight during the workweek, we must subtract 1 from the day
In the case of Sunday, we subtract two, and Monday, subtracdt 3 in order to get Friday's list*/
var intNB = 1
if(currentTime.getDay() == 0)
else if(currentTime.getDay() == 1)
intNB = 3;
intNB = 1;

/*We now need to subtract the number from the day to get the right date (Year, month, and day)*/
var day = currentTime.getDate() - intNB;
var month = currentTime.getMonth() + 1;
var year = currentTime.getFullYear();

/*If the day is less than ten, we must add a 0 to make the day a two digit number*/
if (day




  • I don't think ajax will work cross domain, so you'll need to call a script on your own website to get the data, or you might be able to use an iframe, but I think then you can't manipulate it's contents if it's on another domain as well...

    To answer the question of reading data from the url and placing it in a table you could do something like this:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    function createTable() {
    var params ='&');
    var table = document.createElement('table');
    var tbody = document.createElement('tbody');
    for(var i=0;i

    // this script strips everything after ? and puts the fields in the first td and the value in the second td

    the Netherlands...
  • Hi mac, Thanks for trying but I still can't get the info from the URL to a table. As I said before I am not a programmer and there are a lot of things that I just don't understand, I'm trying to learn. The script that I posted gives me the correct URL daily, but it writes the URL to the page instead of taking the contents of that URL and creating a table with them.
  • if you have the URL in your page, is it inside a div tag like:


    If this is the case you can use javascript to grab that line of text and split it up into pieces. You can use my example, but replace the with documentGetELementById('contentsofothersite').innerHTML

    where contentsofothersite is the ID of the div element that the URL is in.

    hope this helps you out...
    the Netherlands...
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!