jquery getElementById on a ajax data

sau32

New Member
I got a function in javascript that first checks if the username is the required length and than sends the username to a page for a test if the test is a success there will be a \[code\]<span id="username">true</span>\[/code\]else \[code\]<span id="username">false</span>\[/code\]I keep getting an error that getElementById doesn't exist on the return data\[code\] function checkuser(user, wd,id, sub) { if(user.length < 7) { document.getElementById(id).innerHTML = "Your username is too short. It must be longer than 6 charaters"; document.getElementById(sub).disabled = true; return false; } else { $.post(wd + "register/checkuser/" + user, function(data){ alert("Data Loaded: " + data.getElementById('username').innerHTML; }); } }\[/code\]
 
Back
Top