Click here to Skip to main content
12,450,352 members (44,217 online)
Click here to Skip to main content


19 bookmarked

Observer Pattern in web applications (JavaScript): A walkthrough with an AJAX example

, 2 Dec 2010 CPOL
Observer pattern is an excellent technique to deal with one to many relationships among objects.

if(isset($_REQUEST["action_id"]) && $_REQUEST["action_id"]!=""){
	$sxe = new SimpleXMLElement('data.xml', NULL, TRUE);
	file_put_contents('data.xml', $sxe->asXML());
	echo "Temperature updated sucessfully";
if (file_exists('data.xml')) {
    $xml = simplexml_load_file('data.xml');
} else {
    exit('Failed to open data.');

		<title>Edit Temperature</title>
		<form method="post" action="#" />
			<input type="hidden" name="action_id" value="1" />
			Temperature In Degree Celsius<input type="text" name="temperature" value="<?php if(isset($data)){echo $data;} ?>" style="text-align:center"/>
			<input type="submit" value="Update" />

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Albin Abel
Software Developer
India India
I am developer in .Net and GIS.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160826.1 | Last Updated 2 Dec 2010
Article Copyright 2010 by Albin Abel
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid