Posts

Showing posts with the label ankit

Why I moved from Prototype to jQuery

jQuery  is a JavaScript library which follows unobtrusive paradigm for application development using JavaScript. jQuery inherently supports Behavior driven development and is based on traversing HTML documents using CSS Selectors. On the other hand,  Prototype  is a JavaScript library for Class driven development which makes life easier working with JavaScript. Prototype library has a good support in Ruby on Rails via helper functions. I have always used Prototype library for most of my projects until I was introduced to jQuery three months back ... and it enchanted me. The reasons Behavior driven development (BDD) Using jQuery, behavior(s) of HTML elements is defined separately from HTML code similar to defining style of an element using CSS. Lets look at a  simple example  to display alert box on click of an element 1 2 3 4 5 6 $(element).click( function (){ alert ( " warning " ); //fill stub for confirming this action from user }); A comple...

What is Ajax

Image
AJAX = Asynchronous JavaScript and XML AJAX is not a new programming language, but a new technique for creating better, faster, and more interactive web applications. With AJAX, a JavaScript can communicate directly with the server, with the XMLHttpRequest object. With this object, a JavaScript can trade data with a web server, without reloading the page. AJAX uses asynchronous data transfer (HTTP requests) between the browser and the web server, allowing web pages to request small bits of information from the server instead of whole pages. The AJAX technique makes Internet applications smaller, faster and more user-friendly. AJAX is based on the following web standards: JavaScript XML HTML CSS   AJAX applications are browser- and platform-independent. AJAX uses the XMLHttpRequest object With AJAX, your JavaScript communicates directly with the server, through the JavaScript XMLHttpRequest object. By using the XMLHttpRequest object, a web developer can update a pa...

contactus form using jquery slideup and slidedown effect

Image
jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. .slideUp( [ duration ], [ callback ] ) The .slideUp() method animates the height of the matched elements. This causes lower parts of the page to slide up, appearing to conceal the items. Once the height reaches 0, the display style property is set to none to ensure that the element no longer affects the layout of the page. Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings 'fast' and 'slow' can be supplied to indicate durations of 200 and 600 milliseconds, respectively. If any other string is supplied, or if the duration parameter is omitted, the default duration of 400 milliseconds is used. .slideDown( [ duration ], [ callback ] ) The .slideDown() method animates the height of the mat...

How to ban an IP address or site name using .htaccess

Ban using IP address. These are sample IP addresses... 42.12.5.34 193.110.145.185 Code For .htaccess: <Limit GET POST> order allow,deny deny from 42.12.5.34 deny from 193.110.145.185 allow from all </Limit> To ban using site name. Do NOT include the "http://www." portion! These are sample site names:... domain.com abc.com ## SITE REFERRER BANNING RewriteEngine on # Options +FollowSymlinks RewriteCond %{HTTP_REFERER} domain\.com [NC,OR] RewriteCond %{HTTP_REFERER} abc\.com [NC] RewriteRule .* - [F]