jQuery 47 – Ajax 4 – Get, Post and Load ajax methods



jQuery get() , post() and load().
Below methods perform more common type of Ajax requests in less code :

jQuery.get() or $.get() : Load data from the server using a HTTP GET request.
jQuery.post() or $.post() : Load data from the server using a HTTP POST request.
jQuery.load() or $.load() : Load data from the server and place the returned HTML into the matched element.

ankpro
ankpro training
Asp.net MVC
C#
C sharp
Bangalore
Rajajinagar
Selenium
Coded UI
Mobile automation testing
Mobile testing
JQuery
JavaScript
.Net
Components of the .Net framework
Hello World

source

JavaScript for beginners – Chapter 25 – JavaScript Error handling (try, catch, finally and throw)



Error handling in javascript:
JavaScript is a loosely-typed language.
It does not give compile time. So some times you will get a runtime error for accessing an undefined variable or calling undefined function etc.
JavaScript provides error-handling mechanism to catch runtime errors using try-catch-finally block, similar to other languages like Java or C#.
Syntax :
try
{
//code that may throw an error
}

catch(ex)
{
// code to be executed if an error occurs
}

finally
{
// code to be executed regardless of an error occurs or not
}

try : wrap suspicious code that may throw an error in try block.
catch : write code to do something in catch block when an error occurs. The catch block can have parameters that will give you error information. Generally catch block is used to log an error or display specific messages to the user.
finally : code in the finally block will always be executed regardless of the occurrence of an error. The finally block can be used to complete the remaining task or reset variables that might have changed before error occurred in try block.
throw : Use throw keyword to raise a custom error.

ankpro
ankpro training
Asp.net MVC
C#
C sharp
Bangalore
Rajajinagar
Selenium
Coded UI
Mobile automation testing
Mobile testing
JQuery
JavaScript
.Net
Components of the .Net framework
Hello World

source

JavaScript for beginners – Chapter 23 – Arguments Object – part 1



JavaScript Arguments Object :
The javascript arguments object is a local variable available within all functions.
An arguments object includes value of each parameter.
The arguments object is an array like object. You can access its values using index similar to array.
The length property of the arguments object returns the number of arguments passed to the function.
We can pass variable number of arguments to a javascript functions. All the parameters will be stored in the arguments object.
An arguments object is still valid even if function does not include any parameters.
An arguments object can be iterated using for loop.

function ShowMessage(firstName, lastName)
{
alert(“Hello ” + arguments[0] + ” ” + arguments[1]);
}

ShowMessage(“Steve”, “Jobs”);

ShowMessage(“Bill”, “Gates”);

ShowMessage(100, 200);

ankpro
ankpro training
Asp.net MVC
C#
C sharp
Bangalore
Rajajinagar
Selenium
Coded UI
Mobile automation testing
Mobile testing
JQuery
JavaScript
.Net
Components of the .Net framework
Hello World

source

JavaScript for beginners – Chapter 21 – Function (Methods) in JavaScript



Javascript Function(Method)
Function in JavaScript.
A function is a block of reusable code.
Advantage of using a function :
A function allow us to write code once and use it many times as we want just by calling the function.
JavaScript function syntax :
function functionName(parameter1, parameter2,…parameter_n)
{
//function statements
}

Use the function keyword to define a function, followed by the name of the function .
The name of the function should be followed by parentheses.
Function parameters are optional.
Example : Function to add two numbers

function mutliplyNumbers(firstNumber, secondNumber)
{
var result = firstNumber * secondNumber;
return result;
}

Calling the JavaScript function :
Call the JavaScript function by specifying the name of the function and values for the parameters if any.

function mutliplyNumbers(firstNumber, secondNumber)
{
var result = firstNumber * secondNumber;
return result;
}

var multiply = mutliplyNumbers(5, 5);
document.write(multiply);

The parameters that are missing values are set to undefined.
When we specify too many parameter values to the calling function, the extra parameter values will be ignored.
It’s not compulsory, that JavaScript function should always return a value. It totally depends on what you want the function to do.
If an explicit return is omitted, undefined is returned automatically.

ankpro
ankpro training
Asp.net MVC
C#
C sharp
Bangalore
Rajajinagar
Selenium
Coded UI
Mobile automation testing
Mobile testing
JQuery
JavaScript
.Net
Components of the .Net framework
Hello World
Literal
Keywords
Variable
Data types
Operators
Branching
Loops
Arrays
ArrayList
Strings
String Builder
Structures
Enums
Functions
Classes
Inheritance
Polymorphism
Properties
Indexers
Events
Nested Classes
Delegates
Anonymous methods
Labda expressions
Abstract classes
Exception Handling
Linq
Interfaces
Extension methods
Anonymous types
Generics
Collections
Garbage Collection
Reflection
Attributes
Input…

source

jQuery 7 – Selectors – Class selector



jQuery Class selector:
Selecting Elements by css Class Name.

jQuery class selectors uses JavaScript’s native getElementsByClassName() function if the browser supports it.
Syntax :$(‘.class’)

Examples
$(‘.small’) // selects all elements with class small.
$(‘.small, .big’) // selects all elements with class small or big.

ankpro
ankpro training
Asp.net MVC
C#
C sharp
Bangalore
Rajajinagar
Selenium
Coded UI
Mobile automation testing
Mobile testing
JQuery
JavaScript
.Net
Components of the .Net framework
Hello World
Literal
Keywords
Variable
Data types
Operators
Branching
Loops
Arrays
ArrayList
Strings
String Builder
Structures
Enums
Functions
Classes
Inheritance
Polymorphism
Properties
Indexers
Events
Nested Classes
Delegates
Anonymous methods
Labda expressions
Abstract classes
Exception Handling
Linq
Interfaces
Extension methods
Anonymous types
Generics
Collections
Garbage Collection
Reflection
Attributes
Input and output statements
Type casting
Partial Methods
Partial Classes
Boxing and Unboxing
Var vs Dynamic vs Object
using Static.
Auto property initializer.
Dictionary Initializer.
nameof Expression.
New way for Exception filters.
await in catch and finally block.
Null – Conditional Operator.
Expression – Bodied Methods
Easily format strings – String interpolation
Parameterless constructors in structs.
Creating a custom exceptions class.

source

CSS Lesson 20 – CSS Counters



CSS Counters:
CSS counters are the “variables” maintained by CSS whose values can be incremented by CSS rules (to track how many times they are used).
ankpro
ankpro training
Asp.net MVC
C#
C sharp
Bangalore
Rajajinagar
Selenium
Coded UI
Mobile automation testing
Mobile testing
JQuery
JavaScript
.Net

source

C# Beginner to advanced – Lesson 34 – Exception Handling (try, catch, throw and finally)



Types of Errors:
In programming language, whenever we write a piece of code, then we compile and execute. In this situation we may have chance to get three types of errors as mentioned below:
Syntactical Error :
example : “ “ , ; and wrong spelling to syntax.
Compile time Error :
example : “ “ , ; wrong spelling to syntax and Wrong data to a variable
Run time Error :
example : When we are trying to create object to an abstract class.

Exception Handling Mechanism :
Runtime Error is nothing but an exception.
So if program is having some exception, we need to handle the exception and to do that we have Exception handling Mechansim.
Following are the exception handling mechanisms :
Logical implementation
try catch implementation

Syntax for try catch and finally

try {
// block of code to monitor for errors
}
catch (ExcepType1 exOb) {
// handler for ExcepType1
}
catch (ExcepType2 exOb) {
// handler for ExcepType2
}…
finally {
// finally code
}

Generic and Specific Catch Block:
Catch block without Exception Class is called as Generic Catch Block.
Catch block with Exception Class is called as Specific Catch Block.

Commonly Used Exceptions:
ArrayTypeMismatchException
Type of value being stored is incompatible with the type of the array.
DivideByZeroException
Division by zero attempted.
IndexOutOfRangeException
Array index is out-of-bounds.
InvalidCastException
A runtime cast is invalid.
OutOfMemoryException
Insufficient free memory exists to continue program execution. For example, this exception will be thrown if there is not sufficient free memory to create an object via new.
OverflowException
An arithmetic overflow occurred.
NullReferenceException
An attempt was made to operate on a null reference—that is, a reference that does not refer to an object.

ankpro
ankpro training
Asp.net MVC
C#
C sharp
Bangalore
Rajajinagar
Selenium
Coded UI
Mobile automation testing
Mobile testing
JQuery
JavaScript
.Net
Components of…

source

Advanced JavaScript – Chapter 16 – IIFE Immediately Invoked Function Expression (IFFY)



IIFE Immediately In-vocable Function Expression (IFFY) :
Immediately Invoked Function Expression (IIFE) is one of the most popular design patterns in JavaScript.
IIFE has been used since long by JavaScript community but it had misleading term “self-executing anonymous function”.

IIFE in JavaScript.
IIFE is a function expression that automatically invokes after completion of the definition.
The parenthesis () plays important role in IIFE pattern.
In JavaScript, parenthesis cannot contain statements; it can only contain an expression.

Advantages of IIFE:
Do not create unnecessary global variables and functions
Functions and variables defined in IIFE do not conflict with other functions & variables even if they have same name.
Organize JavaScript code.
Make JavaScript code maintainable.

ankpro
ankpro training
Asp.net MVC
C#
C sharp
Bangalore
Rajajinagar
Selenium
Coded UI
Mobile automation testing
Mobile testing
JQuery
JavaScript
.Net
Components of the .Net framework

source

Advanced JavaScript – Chapter 11 – JavaScript closure



JavaScript Closure:
Closure is one of important concept in JavaScript.
Closure means that an inner function always has access to the variables and parameters of its outer function, even after the outer function has returned.

ankpro
ankpro training
Asp.net MVC
C#
C sharp
Bangalore
Rajajinagar
Selenium
Coded UI
Mobile automation testing
Mobile testing
JQuery
JavaScript
.Net
Components of the .Net framework

source

Advanced JavaScript – Chapter 12 – Prototype in JavaScript



Prototype in JavaScript:
JavaScript is a dynamic language, so we can attach new properties to an object at any time.

Prototype is an object that is associated with every functions and objects by default in JavaScript, where :

Function’s prototype property is accessible and modifiable.
Object’s prototype property is not visible.

Every function include prototype object by default.

The prototype object is special type of object to which additional properties can be attached to it which will be shared across all the instances of it’s constructor function.

ankpro
ankpro training
Asp.net MVC
C#
C sharp
Bangalore
Rajajinagar
Selenium
Coded UI
Mobile automation testing
Mobile testing
JQuery
JavaScript
.Net
Components of the .Net framework
Hello World
Literal
Keywords
Variable
Data types
Operators
Branching
Loops
Arrays
ArrayList
Strings
String Builder
Structures
Enums
Functions
Classes
Inheritance
Polymorphism
Properties
Indexers
Events
Nested Classes
Delegates
Anonymous methods
Labda expressions
Abstract classes
Exception Handling
Linq
Interfaces
Extension methods
Anonymous types
Generics
Collections
Garbage Collection
Reflection
Attributes
Input and output statements
Type casting
Partial Methods
Partial Classes
Boxing and Unboxing
Var vs Dynamic vs Object
using Static.
Auto property initializer.
Dictionary Initializer.
nameof Expression.
New way for Exception filters.
await in catch and finally block.
Null – Conditional Operator.
Expression – Bodied Methods
Easily format strings – String interpolation
Parameterless constructors in structs.
Creating a custom exceptions class.

source

1 2