-
Submit forms with POST method using AJAX
AJAX (Asynchronous JavaScript And XML) is a keystone of Web 2.0 and is very useful in many aspects, because it offers the possibility to change the structure of the page (DOM). For instance, it makes possible sending a form in a website without having to reload the whole page (’asynchronously‘ is the magic word here). The data submitted is processed and may be saved in a database just like classic forms do, but the user can continue browsing during the process.AJAX forms are a must-have for any AJAXed website. They can be used for many, many purposes: for checking whether a username already exists in the database; for seamlessly sending registrations, feedback or comments; or even for creating a shoutbox or chat script.
Read the rest of this entry » -
Calculating age with JavaScript
I’ve been working on a simple form – nothing really challenging – where members of a group can provide some data about themselves for registration purposes. However I tried adding an extra function to it: a small text field next to where they input their birth data, which displays their age (according of course to the birth date they provided).I thought therefore I could share this small piece of code so that other people wishing to add it to their websites can use it. The internet is already full of such scripts, but who knows, maybe someone finds it here and finds it useful…
-
Refreshing DIV content with AJAX (multiple DIVs)
After reading the post Refreshing DIV content with AJAX, you already know how to refresh the content of a DIV in your website with the help of AJAX. But perhaps you want to refresh more than one DIV, and you’ve realised the code in the other post didn’t work! Don’t panic, as a matter of a fact refreshing multiple DIVs is the same process than refreshing a single DIV. I’ve prepared an example and some code so you can see how easy it is. See the working demo here. -
AJAXifying your site’s navigation
This post is inspired in Refreshing DIV content with AJAX. However this code does not actually automatically refresh the contents of a DIV but it refreshes them when the user clicks a link. The implementation of the code below allows to refresh the contents as mentioned, but the content retrieved can be different every time. This is very useful to make a website work in a similar way as with frames, but with more advantages and without the disadvantages of frames.I provide the code necessary to achieve this purpose but I don’t present it like a step-to-step tutorial. This is because I guess that for anyone with minimal knowledge of HTML and JavaScript is totally self-explanatory and because I would prefer you to make your website look like you want it to rather than like my post tells you to.
You can see a demo page with AJAX navigation here.
-
Retrieving custom data into EventList
This is the second part of the post Adding custom fields to EventList, where I explained how custom data fields can be added to EventList Joomla Component by Schlu. In this post I will cover how to take full advantage from those custom fields by making EventList RC1.0 for Joomla 1.5 retrieve the information submitted through them.As I mentioned in the first part, EventList does not allow (yet) a user-friendly system for adding custom fields, therefore there’s no user-friendly system either to retrieve custom data into EventList. Some modifications to the core files of the component are required for this purpose. The good news is, that it is not as complicate as it might seem at first.
-
Automatically query MySQL and output results with AJAX
This is an extension of the post Refreshing DIV content with AJAX. I recommend you read it at first because you will understand better what the script below is about.What this script does is the following: without having to press any refresh button, and not even reloading the whole page (but a DIV), it retrieves every X seconds the specified data from a MySQL database and displays in the DIV the refreshed contents of it. In other words, it queries the database regularly and updates the output. Read the rest of this entry »
-
Populating a dynamic drop down menu from a MySQL database
This PHP code snippet retrieves the data in a specific column of each row in a MySQL table. The retrieved data is echoed to the DOM and displayed as options of a drop down menu. The options of the drop down menu are dynamic, as they will change automatically every time the information in the database is modified. -
Refreshing DIV content with AJAX
AJAX (Asynchronous JavaScript And XML) is a keystone of Web 2.0 and is very useful in many aspects, because it offers the possibility to change the structure of the page (DOM). For instance, it makes possible refreshing a part of a website instead of having to use the classic page reload, which requests again the whole page from the server even when the updated parts are minimal (much slower and of course consumes more bandwidth; therefore making the visitor experience worse).If you know what a HTML <div> tag is and how to use it, with the help of AJAX refreshing a section of your website is possible. The section which will be refreshed is within a DIV; the rest of the HTML outside the DIV will not be refreshed.
To show you how to do so, I prepared an example with the code required for this purpose. But if you’re new to AJAX and would like to know how the code works, I recommend you to take a look at first at w3schools AJAX tutorial.
-
Showing registered users in EventList module
When using EventList module in conjunction with EventList 1.0RC component for Joomla 1.5, I missed the possibility of displaying in the module the number of registered attendees to each event, together with the already showing date, time, event name, etc.My approach to the issue was to add some extra PHP code to the EventList Mod template; concretely the code below. But before you attempt to try the same in your website, remember to backup the affected file.
-
PHP: converting string into formatted date
While coding I came across the following situation: a date which was showed with the format YYYY-MM-DD, but I wanted its format to be DD-MM-YYYY.Obviously there’s the PHP Date function, you will think, but the point here is that the initial date was a variable as string. Therefore using directly the date function did not work…luckily it is not difficult to find out how to get the desired results.


