Sim Posted March 22, 2009 Posted March 22, 2009 I want to create an ajax mud and I was wondering how to update an area of text with new text that is retreived from the mySQL database from the command giving by the user? Quote
Floydian Posted March 23, 2009 Posted March 23, 2009 Re: Updating an area with new text inputed by user? element.innerHTML is a very common method. The innerHTML property sets the contents of the element and causes the browser to render any html that's included. Quote
Sim Posted March 23, 2009 Author Posted March 23, 2009 Re: Updating an area with new text inputed by user? confused =( Quote
BlueDevil23 Posted March 23, 2009 Posted March 23, 2009 Re: Updating an area with new text inputed by user? Check out my AJAX preferences, I did exactly what your looking for with the all of it, but namely the User Signatures - which will probably help you most. * Keep in mind I use the Dojo Toolkit for the AJAX calls here. http://criminalexistence.com/ceforums/h ... 85#p121985 If you need more help, you know where to catch me, I'm always in IRC... Quote
Floydian Posted March 23, 2009 Posted March 23, 2009 Re: Updating an area with new text inputed by user? Copied and pasted with permission to preserve the continuity of the thread. [20:58] <floydian> what's confusing ya about what I said in the forum? [20:58] <Sim> I dunno. what I do with innerHtml? [20:59] <floydian> first, you need to "get" the element you're putting the response into [20:59] <floydian> have you done that? [20:59] <Sim> hmm No. I don't know where to even begin with ajax. I downloaded an ajax chat example to try to learn from but it doesn't use mySQL. it uses a txt file. [21:00] <floydian> (and to make the thread make sense, I'll post what's said here so it closes up that thread nicely) [21:00] <Sim> Sounds good to me. [21:00] <floydian> it sounds like you need to study some ajax examples then [21:01] <floydian> there's lots of them out there [21:01] <Sim> http://ce.pastebin.com/m26c7883c [21:02] <Sim> I can figure out how to write to mySQL file without refreshing page. [21:02] <Sim> just not read from and update from mySQL [21:03] <Sim> Is it as simple as echoing? ;] [21:03] <floydian> # [21:03] <floydian> function ajax_read(url) { [21:03] <floydian> when you do that function call [21:03] <floydian> the URL you put in there [21:03] <floydian> will be executed as a normal page would [21:03] <floydian> and yes, anything you echo from that file that is executed [21:04] <floydian> would be placed into the web page [21:04] <floydian> by [21:04] <floydian> document.getElementById("chatwindow").innerHTML = xmlhttp.responseText; Quote
Sim Posted March 23, 2009 Author Posted March 23, 2009 Re: Updating an area with new text inputed by user? Right. We'll i'm still having problems. http://teampo2.com/chat/ my php file: is a simple: echo $_GET['m'] . ' '; Quote
Floydian Posted March 23, 2009 Posted March 23, 2009 Re: Updating an area with new text inputed by user? That recursive call to ajax_read() is killing the script. And you still have the script outside of the HTML tags... Quote
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.