• Help cleaning up some awful JS

    From Deepthaw@VERT/DS94 to All on Mon Jun 19 13:49:29 2017
    Full disclosure: JavaScript is *not* my first language. That'd be C++.ããI've been modifying electronic chicken's v4 web interface to automatically addãlogos for external programs if they exist on the web server.ããI have some kludgy code that *works* but I guarantee it's not the best way toãdo it. I'm just not familiar enough with JS and jquery to know what theã"correct" ways to do it are.ããHere's the relevant code. It checks if a .png (I'm going to tweak it to searchãfor jpg and gif as well) with a name matching the code for that externalãprogram exists, then resizes it to a maximum 150px wide icon to display aboveãthe title of the external program.ããvar image = "./images/" + xx.c + ".png";ã $.ajax({ã url: image,ã type:'HEAD',ã error: function()ã {ã $(a).text(xx.n);ã },ã success: function()ã { ã
    $(a).html("<img style=\"max-width:150px;\" srcã= \"" + image + "\"><br/>");ã $(a).append(xx.n);ã }ã });ãã---ã þ Synchronet þ Deep Space '94 - bbs.deepthaw.com - The Best 1994 Had to Offerã