AJAX getElementById and innerHTML not working?
Permalink
I'm trying to make a custom shout box block. The message is being retrieved and sent to a php file which writes to a txt file, which works fine...
But some things aren't working like they do outside of Concrete5.
Here is the some of the code that isn't working:
But some things aren't working like they do outside of Concrete5.
Here is the some of the code that isn't working:
document.getElementById("chatwindow").innerHTML = "loading...";
function ajax_read(url) { if(window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); if(xmlhttp.overrideMimeType){ xmlhttp.overrideMimeType('text/xml'); } } else if(window.ActiveXObject){ try{ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ } }
Viewing 15 lines of 17 lines. View entire code block.
use jquery! It's a lot easier and you need less code.. And since it's already integrated in c5 you can start using it without thinking anything about it...
Haha! I've been putting off learning jquery, looks like I don't have a choice now...
Can you recommend a good tutorial site for jquery?
Can you recommend a good tutorial site for jquery?
I find the official jquery stuff very easy.. It takes a while to get into it but I loved it once I know how it works..
You should first try to understand how it works.. It's important to know about the $ function and the selectors..
http://docs.jquery.com/How_jQuery_Works...
From there you can easily go on and use methods like val, html, attr, css to manipulate things. Very easy to do.
You should first try to understand how it works.. It's important to know about the $ function and the selectors..
http://docs.jquery.com/How_jQuery_Works...
From there you can easily go on and use methods like val, html, attr, css to manipulate things. Very easy to do.