Saturday, July 24, 2010

AJAX

Ajax is powerful tool for making your web application faster more userfriendly. Javascript cannot communicate with server but Ajax makes it possible. Javascript can communicate with web server using XMLHttpRequest object. With the help of this we can pass request to the server in background. Because of this user gets faster response from server & need not reload whole page. 
Ajax is technique of changing the part of web page without reloading the whole page. We can request text, XML, php, aspx, html or any file from the server.
Disadvantages of Ajax
* Ajax based web pages cannot be indexed by search engines because search engine neglects code written in javascript.
* Bookmarking not works with Ajax based web pages. You can bookmark but it doesnt work the way you expect.
* Security problem Ajax code is visible to everyone you need tobe validat data coming from browers.
* I heard it might not work properly in slow internet speed.

Difference between true & false
when we call open() method of XMLHttpRequest object it takes third parameter either true or false.
false tells  XMLHttpRequest object to wait until request is completed before executing the next statement.
It is ok when request or application is simple but is request is long then application hang or stop.

True tells that continue the execution after the request to the server has been sent. With this you cant sure about response from server so that you have to use onreadystatechange property.

I heard about AJAX is differnt technologies can communicate.
AJAX is easy to learn it is not new language it is based on existing standard. check w3schools for more details.....


--
Amol.....
9595991644

Monday, July 19, 2010

XML

XML
extensible Markup Language designed to transport & store data. XML document contains plain text wrapped in tags. It is like a plane text file with .xml extension.HTML & XML are totally differnt html is designed how to display data & xml how to stor data. XML seperates data from HTML.I most liked xml defination is "It is software & hardware independenet tool for carring information". Xml's advantages are it greatly simplifies data sharing, data transport, increases data availablity. Dont confuse xml with database. xml comes in the picture when data is not so complex, not large but plain text file are not enough to handle then you can go for xml.

Syntax Rules
-All XML elements must be closed.
-All xml elements must ne properly nested.
-Attribute values must be quoted.
-XML elements are case sensitive.

XML Parser
To manipulate xml document we need xml parser.xml parser reads xml document & covert it into the XML DOM object that can easily accessed with javascript. Most of the browsers have built-in xml parser.There are two types of xml parser tree-based & event-based. Event-based parser is faster than tree-based.

How to load xml document
- First get xmlHTTPReqest object
- open request
- send request to the server
- get respose from server

<script type="text/javascrit">
if(window.XMLHttpRequest)
{
xhtttp = new XMLHttpRequest; // mozilla
}
else
{
xhttp = new ActiveXObject("Microsoft.XMLHTTP"); // IE
}
xhttp.open("get","filename.xml",false);
xhttp.send("");
xmldoc = xhttp.resposnseXML;

document.getElementById("result").innerHTML = xmlDoc.getElementsByTagName("nameof tag in xmlfile")[0].childNodes[0].nodeValue;
<script>

XML DOM
Document Object Model defines a standard way for accessing & manipulating xml document. It provied all functions to create, delete, update xml elements.


PHP XML Parser
To manipulate xml document in php there are three ways to Expat Parser, SimpleXML Parser & XML DOM.
Expat is event-based parser & faster because it focus on the content of the document not its structure.

SimpleXML Parser is easy way to read change delete xml elements but when you want to deal advance xml then you have to decide other parser.
e.g.
$xml = simplexml_load_file("Filename.xml");
echo $xml->asXML;
OR
$xmldom = new domDocument;
$xmldom->load("Filename.xml");
$xmldom->saveXML();

Monday, July 5, 2010

Regular Expression


Solves a big problem in javascript specially because in javascript there are no built-in functions
for form validation. Then Regular Expression comes to help you. Main theme is when you want to check
a certain type of pattern say finding only digits or valid email address, then you have to write a
pattern in which all that condition must satisfy. you can check any pattern like validating email ID,
phone nos, credit cards nos, text, numbers. I thing regular expression used in many languages like java,
php, ruby, perl & more.
For more details "& example go to http://www.regular-expressions.info/

Thursday, July 1, 2010

TabIndex

It is used to set the focus on the HTML object when user uses tab key. When user pressed tab key then by default it starts from the top, but we want when user press tab key then focus must be given to particular text, buttton, link etc. Then use tabindex property.
&lt; input type="text" id="user" tabindex="1" />