GameYin Posted September 6, 2008 Share Posted September 6, 2008 http://forums.devshed.com/php-development-5/ajax-chat-555198.html Sorry I don't wanna repost everything as it is a long post. Anyone have reasons? gameyin.com/ajaxchat/ Quote Link to comment Share on other sites More sharing options...
GameYin Posted September 6, 2008 Author Share Posted September 6, 2008 Ugh sorry I broke rule # 16, but it's a really long post!! Sorry in advance. Quote Link to comment Share on other sites More sharing options...
runnerjp Posted September 6, 2008 Share Posted September 6, 2008 ok 1st wrong room try ajax room...... also it looks ok too me but have you got your data for tables ect right and possibly the host pass ect Quote Link to comment Share on other sites More sharing options...
GameYin Posted September 6, 2008 Author Share Posted September 6, 2008 Ugh yes I do. Sorry for wrong thread but I believe the AJAX part isn't wrong. No errors are given. If you would please go to the site (not trying to be rude) and type something in, you will see nothing happens. The data isn't going to the table and thus nothing shows up. (My theory). (Well, I KNOW it isn't going to the table (SELECT * FROM chat)). Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 6, 2008 Share Posted September 6, 2008 Not sure but you have a html/css issue, highlighted below <div id="view_ajax" style="overflow=auto; width: 500px; color:red; height: 300px; border: 1px dotted red;"> CSS attributes are assigned with a colon ( : ) not an equals sign. As for why the message is not being displayed there is most probably a bug in your Javascript. You may want to try FireBug (a Firefox extension) a try to debug your JavaScript. Also do not bump your post ever couple of hours, allow up to 12 hours for a reply. It also helps if you posted your problem in the correct forum, posting in the forum with the "most traffic" will not get your question answered quicker. Quote Link to comment Share on other sites More sharing options...
GameYin Posted September 6, 2008 Author Share Posted September 6, 2008 I believed my problem was not with JavaScript/Ajax so I posted this in the PHP help. As it turns out I was right. I'm now trying to make it so you can set your own username. Will post back soon Also I tend to get ancy when I can't figure something out. Quote Link to comment Share on other sites More sharing options...
GameYin Posted September 6, 2008 Author Share Posted September 6, 2008 Ok Now I need help with JavaScript. I want users to set their own username. gameyin.com/ajaxchat/ type in the 2nd text field waht you want your username to be function setName() { var username = document.set.Name.value; username=document.cookie = "name="+ username + ";"; http[username]=createRequestObject(); http[username].open(\'get\', \'submit.php?username=\'+ username); http[username].send(null); } </form> <form name="setMyName" id="set" method="get"> <input type="text" id="Name" /> <input type="submit" onclick="setName()" /> </form> Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted September 6, 2008 Share Posted September 6, 2008 Make a PHP file that queries the database for new comments. Then write an AJAX function to call that file. Lastly, use a setInterval JavaScript function to call that AJAX function. Easy as pie. Quote Link to comment Share on other sites More sharing options...
GameYin Posted September 6, 2008 Author Share Posted September 6, 2008 You seem to think I'm pro at this stuff xD. I'm only 16...I know a little bit of PHP but AJAX is my worst part. Quote Link to comment Share on other sites More sharing options...
GameYin Posted September 6, 2008 Author Share Posted September 6, 2008 How would I set a JavaScript cookie, by looking on submit.php's query string, and if username=so and so exists, create a cookie, and then reference it...HOW DO I DO THAT GAHH. Quote Link to comment Share on other sites More sharing options...
GameYin Posted September 6, 2008 Author Share Posted September 6, 2008 In my setName function, I wasn't calling the form...I got part of it owrking. I can get a name to display, but you can't get a message in. Like, if you fill out both fields, ...hard to explain, go there and mess with it. The database is only adding a name OR text depending on which submit button you do. Should I combine functions?? Quote Link to comment Share on other sites More sharing options...
corbin Posted September 6, 2008 Share Posted September 6, 2008 You seem to think I'm pro at this stuff xD. I'm only 16...I know a little bit of PHP but AJAX is my worst part. Errrr.... I'm only 16 ;p. Has less to do with age and more to do with how long you've been coding. Anyway, if you want users to not be able to steal each other's names, you will probably want to log them in via some kind of PHP script, and just use sessions. Quote Link to comment Share on other sites More sharing options...
GameYin Posted September 6, 2008 Author Share Posted September 6, 2008 I've been coding since 13 but I'm more of an HTML/CSS person. Didn't answer my question. Do I combine the 2 functions? Quote Link to comment Share on other sites More sharing options...
GameYin Posted September 7, 2008 Author Share Posted September 7, 2008 http://gameyin.com/ajaxchat/ GOT IT WORKING.........YESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS. Took me a total of 7 hours of straight work, rewriting the code until I got it. F*** YEA. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.