Greetings and welcome to an all-new tutorial series, Peter's Webdev Workshop. This tutorial series will focus on web development, mainly focusing on using PHP as a server-side language, but I'm not ruling out having a crack at Python or Ruby, ASP.NET/Mono C# or something like that. This series will also look at JavaScript on the client side and we'll be using XHTML for all the markup.

Before I jump into today's topic, there's a bit of admin and introduction I need to do to start up the new series. See you after the jump!

All the code examples I use in this series will be released under the Modified BSD Licence (unless I mention otherwise), meaning that you're free to take the code examples, modify them and/or use them in your application, whether open or closed source, provided you mention me (there are a couple of other minor things too). Of course if you get inspired by my code and write something equivalent that does the same job, you can do what you want with it, it's yours. For reference, you can read the whole licence here.

Unlike Beginner's Linux, this series will expect you to be familiar with (X)HTML and to have some basic skills with PHP and some JavaScript knowledge. I won't start with too difficult things and as this series evolves we'll probably see some introductions and other groundwork.

This tutorial, however, throws you in at the level of building your first ever Ajax application in PHP. So for this one, you need a working knowledge of PHP and a good grasp of programming basics.

Ajax - isn't that some kind of cleaner?

No, not that Ajax. Ajax, or Asynchronous JavaScript and XML, is a new web technology that allows you, basically, to utilise JavaScript to get data from a server without reloading the whole webpage. This comes in handy for many things and is powering all of the new 'rich web applications' that are popping up now (Google Maps, Y!Mail Beta, Writely/Zoho Writer).

Basically Ajax means you can have elements of the page dynamically loaded without a page reload (asynchronously to the reloading), meaning you can update elements of the page without receiving the whole page again and without affecting the rest of the page. The XML part comes in when you get data from the server in XML format, then use JavaScript to parse that XML and do something useful with it.
Ajax works with any server-side technology, including PHP, Perl, ASP(.NET), Python, Ruby, ColdFusion, SSI, JSP... you get the idea, anything. We'll of course be using PHP.

Right, so how do I start?

For this demo, we're going to keep it simple and have two files. index.php is our main file that is loaded in the normal way by the user, and ajax.php is the script that JavaScript will call and will deliver some information.

So what are we actually going to do? Well, let's break it down:

* index.php will contain a form where the user can enter their name.
* When submitted, the form will talk to ajax.php and determine whether that name is in a predefined list.
* If it is, we will say 'Welcome back'. If not, we will say 'Nice to meet you, stranger!'.

Now this isn't particularly groundbreaking. If you wanted, you could do it in JavaScript alone, but that's not the point. Once you know how to do this, you can adapt this to do something a bit more interesting.


Comments


Log in to comment or register here.
Intro Top Scripts Live Feed

About Scriptremix.com

Scriptremix.com is a online web script content site powered by people like you which aims to collect the best resources, tips, and ideas about CSS, HTML, SEO, JavaScript, AJAX, PHP, ASP, .net, linux, XML, CMS, BLOG, Prototypes, Browser Compatibility and much more in online web.

You can submit and share your favorite web script here in just few easy step.

Submit Script

Top Search Tag Cloud
accessible adhd adsense affiliate affiliate programs affiliate software ajax ajax call ajax request alstrasoft animation api api script application applications asp.net atlanta august autocomplete autocompletion automatically autosuggest background beta blog blogging bonus browser business calendar carousel cctv video security camera systems change class classes classifieds client-side clone cms code coins coldfusion collection comments community community software compatibility component components content management system control create creating cross-browser css database date default del.icio.us demo demonstration descargar design designed developer development dhtml digg dimensions display div document documentation dom domain download drag drag & drag and drop draggable drawing dynamic dynamically easy effect effects element elements engine episode example examples experience extensions extjs facebook facebox features file firefox flash flickr forex form forms framework free fully functional classifieds site function functionality gallery games google graphs gratis great gridview grupo hidden cameras home hotscripts.com how html ideas image images implementation improve indicator information infrared illuminators input install installing interface iscripts java javascript javascript framework javascript library jonged joomla joomlatemplatesme jquery jquery library jquery plugin js json juego juegos jugar layout layouts library lightbox lightweight link links loading mah-jong mahhjong mahjong mahjonged mahjongg majong marketing markup mayan menu menus message modal module mootools multiple myspace mysql navigation number object online open open source optimization options page password photo php php and mysql php script php scripts plug-in plugin plugins png podcast popup powerful presentation professional program programming progress project prototype prototypejs rails release released replacement resize review rockettheme rss ruby ruby on rails script script.aculo.us scriptaculous scripting scripts scroller search search engine searching security security cameras systems sef seo september server silverlight simple site slider slideshow social networking social networking script software sql stable strategies string style stylesheet suite support svn table tag tag cloud technique techniques template templates th the theme thumbnails tip tips tooltip trading training tutorial tutorials unobtrusive unobtrusive script update upload upload script user using validation versatility version video video surveillance cameras viral ways web web application web applications website websites widget widgets wiki wikipedia window windows wordpress wysiwyg x xhtml xml yahoo youtube yui