Support » Fixing WordPress » Help with my first java script attempt

  • drsanders2k


    I have extracted some js code from a working non-WordPress page, and I’m trying to make it work on my site. It defines a function and then executes a URL with a callback to that function. I can run the URL without the callback and I see the data I’m trying to access. It appears that the callback is not executing my function, as the data never gets displayes. Can someone help me get off square one? I’m a js novice, so be kind! 🙂

    Here are the entire contents of my page:

    <script type="text/javascript" >
    function showEvents(json){
    var statusHTML = [];
    	for (var i=0; i<json.length; i++) {
    		var p = json[i];
    	    statusHTML.push('<table cellpadding="0" cellspacing="0">');
    		for (var j=0; j<p.length; j++) {
    			var sd = Date.parseDate(p[j].STARTDATE, "F, d Y g:i:s");
    		    statusHTML.push('<tr><td class="StartDate">'+ sd.dateFormat("F d") +'</td></tr>');
    		    statusHTML.push('<tr><td class="Event"><a href="##" onclick="goView('+p[j].EVENTID+');">'+p[j].EVENTNAME+'</a></td></tr>');
    		    statusHTML.push('<tr><td><hr size="1" color="#005daa"></td></tr>');
     document.getElementById('Events').innerHTML = statusHTML.join('');
    document.getElementById('Events').innerHTML = statusHTML.join('');
    <div id="Events">Loading...</div>
    <script src="" type="text/javascript">

  • The topic ‘Help with my first java script attempt’ is closed to new replies.