Well, till now i am not familiar about Jquery. months back, during discussion i told an expert programmer that, i don’t know Jquery. and he replied: “Don’t worry about JQuery. JQuery is Designer stuff not developer but it’s nice to know how to integrate and it works”.
As though, i am really lazy one i can’t start learning Jquery upto yesterday. But today is good time for me to learn jquery stuff. So here is my index of learning:
1. Understand basic concept of JQuery.
2. Integrate JQuery in a simple scratch build php page(registration.php)
3. Integrate JQuery in Code Igniter
4. Integrate JQuery in Symfony.
1. Understand basic concept of JQuery.
Well, jquery is nothing but a helpful file. which means that, first i need to dowload jquery.js file and put it somewhere in my project. now, most popular thing is form validation. to validate a form what we need is, first download jquery.validate.js file. moreover, here is a list of validation stuffs.
http://docs.jquery.com/Plugins/Validation
2. Integrate JQuery in a simple scratch build php page(registration.php)
<html>
<head>
<script src=”jquery-1.3.2.min.js”></script>
<script src=”jquery.validate.js”></script>
<script>
$(document).ready(function(){
$(“#commentForm”).validate();
});
</script>
</head>
<body>
<form id=”commentForm” method=”post” action=”test.php”>
<fieldset>
<legend>A simple comment form with submit validation and default messages</legend>
<p>
<label for=”cname”>Name</label>
<em>*</em><input id=”c_name” name=”name” size=”25″ class=”required” />
</p>
<p>
<label for=”cemail”>E-Mail</label>
<em>*</em><input id=”cemail” name=”email” size=”25″ class=”required email” />
</p>
<p>
<label for=”ccomment”>Your comment</label>
<em>*</em><textarea id=”ccomment” name=”comment” cols=”22″ class=”required”></textarea>
</p>
<p>
<label for="cbd">Birthday</label>
<em>*</em><input id="cbd" name="cbd" size="25" class="required date" />
</p>
<p>
<label for="curl">URL</label>
<em> </em><input id="curl" name="url" size="25" class="url" value="" />
</p>
<p>
<input class=”submit” type=”submit” value=”Submit”/>
</p>
</fieldset>
</form>
</body>
</html>
3. Integrate JQuery in Code Igniter:
It’s surprising for me, according to my plan i go over CI forum and search “how to integrate Jquery with CI” i found that, there are nothing special !! it’s really simple and easy. nothing special. only the difference for me is that, i use master template concept now i days. where my view file is not as usual even for write which css and js files will include there are a specific page. this kind of splliting(part of master page concept) have huge advantage over conventional. i shall write that in some other days. so i integrate jquery js files there and in my main page i add the following script(for registraton validation):
<script>
$(document).ready(function(){
$(“#commentForm”).validate();
});
</script>
4. Integrate JQuery in Symfony:
Will be exactly same as CI. because both follow MVC pattern. so no worry about Symfony as well.
End of the day, first time in my life i do something in time according to my plan
Enjoy Jquery