![]() |
Refresh an input field
Does anybody know of any AJAX either standalone or part of the jquery or mootools library that will allow me to refresh text inside of a single input field without reloading the page?
All I can find are input form field 'hint' scripts. I want to add a link next to a field that says 'generate new random string' and it'll use a php function I have to refresh the string that's in the input field. -m |
Here's a script with Mootools.
HTML first. HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> PHP Code:
|
To do this with no library and make it a lot easier
Code:
<script type="text/javascript">Code:
<?php |
If he's already using a library, there is no reason to reinvent the wheel!
|
Quote:
By the way, to make it even lighter and still usable in all modern browsers you could even downsize to this Code:
<script type="text/javascript"> |
Nice, thanks both of you.. I am using two libraries actually, because my knowledge of PHP is growing, but my knowledge of AJAX and Javascript is next to none... so I have jquery on my web site to do a few neato things here and there (nothing useful, just neato), and I'm using mootools in my documentation so that the anchors scrolllllll nice and smoothly instead of jumping. Again, not useful, just neatoooo.
Neither is in the middle of a situation where performance is made questionable, so I'm good with it. This will be my first 'useful' use of AJAX hahah. I have to use a seperate php script hey, no way to call a function that's already embedded in the same page? (well technically it's not, the file it's from is included, but eh...) I'll give it a go here soon and let you know how it went, thanks again. -m |
| All times are GMT. The time now is 08:39 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0