Learning from jQuery

Learning from jQuery

Callum Macrae

Language: English

Pages: 116

ISBN: 1449335195

Format: PDF / Kindle (mobi) / ePub


If you're comfortable with jQuery but a bit shaky with JavaScript, this concise guide will help you expand your knowledge of the language-especially the code that jQuery covers up for you. Many jQuery devotees write as little code as possible, but with some JavaScript under your belt, you can prevent errors, reduce overhead, and make your application code more efficient. This book explores event handling, prototypes, and working with the Dom and Ajax through examples and lots of code. You'll learn common conventions and patterns in JavaScript and-if you've never coded with JavaScript before-a tutorial will take you through the basics.

  • Enhance your jQuery code by using object constructors and prototypes
  • Reduce overhead and gain more control by handling events with JavaScript
  • Work with the Dom much faster with JavaScript than you can with jQuery
  • Send a few Ajax requests without having to load the entire jQuery library
  • Understand the importance of JavaScript code standards, comments, code reuse, and anti-patterns
  • Enlist JavaScript resources, such as a good IDE, a syntax checker, and version control

Node.js for PHP Developers: Porting PHP to Node.js

Getting Better: Why Global Development Is Succeeding--And How We Can Improve the World Even More

.net [UK] (May 2015)

Introduction to Programming Using Python

Software and System Development using Virtual Platforms

 

 

 

 

 

 

 

 

 

 

 

 

 

Explorer var req = new ActiveXObject('Microsoft.XMLHTTP'); 35 } var url = '/ajax/?foo=bar'; req.open('GET', url, true); req.onreadystatechange = function () { if (req.readyState === 4 && req.status === 200) { console.log(req.responseText); } else if (req.readyState === 4) { throw new Error('XHR Request failed: ' + req.status); } }; req.send(); That sends a GET request to /ajax/?foo=bar, and then if the request succeeds, logs the output to the console. If it fails, it throws an error. There

time() is: A Simple Application of AJAX | 39 As we reload the page, it will update. However, what if we want to update it using a button or automatically? We could use a button to refresh the page, or we could use AJAX. First, we will need to check whether the request is an AJAX request, and then if it is AJAX we will return only the value of time(). Save this as ajaxUpdate.php:

on-demand digital library that delivers expert content in both book and video form from the world’s leading authors in technology and business. Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training. Safari Books Online offers a range of product mixes and pricing programs for organizations, government agencies, and individuals.

can use the following code instead, which uses the special kind of self-invoking function known as a self-defining function: var matchesSelector = (function () { if (HTMLElement.prototype.matchesSelector) { return function (element, selector) { return element.matchesSelector(selector); }; } else if (HTMLElement.prototype.webkitMatchesSelector) { return function (element, selector) { return element.webkitMatchesSelector(selector); }; } else if (HTMLElement.prototype.mozMatchesSelector) { return

E. F. Friedl. There are two ways to create a regular expression in JavaScript. The first is the preferred way, but if you want to accept user input into the regular expression, then you have to use the second: var regex = /(?:foo)+/g; var regex2 = new RegExp('^' + username + ': (.+)$', 'i'); The first method utilizes the RegExp literal, while the second just creates a new instance of the RegExp object. Both methods have the same end result, but the first is more readable and slightly more

Download sample

Download