Posts

Showing posts from February, 2016

Difference between array, arraylist, List, Hashtable, Dictionary and SortedList in c#

Basic difference is that arrays are of fixed size. Whereas an ArrayList implements the list data structure and can dynamically grow. While arrays would be more performance that a list, a list would be far more flexible since you don't need to know the required size initially. Array - represents an old-school memory array - kind of like a alias for a normal type[] array. Can enumerate. Can't grow automatically. I would assume very fast insertion, retrieve and speed. ArrayList - automatically growing array. Adds more overhead. Can enum., probably slower than a normal array but still pretty fast. These are used a lot in .NET List - one of my favorites - can be used with generics, so you can have a strongly typed array, e.g. List . Other than that, acts very much like ArrayList. Hashtable - plain old hashtable. O(1) to O(n) worst case. Can enumerate the value and keys properties, and do key/val pairs. Dictionary - same as above only strongly typed via generics, such a...

Difference between onload() and document.ready() function used in jQuery?

We can add more than one document.ready() function in a page.   we can have only one onload function.   Document.ready() function is called as soon as DOM is loaded.   body.onload() function is called when everything (DOM, images)gets loaded on the page.

How to get the server response from an AJAX request using Jquery?

When invoking functions that have asynchronous behavior We must provide a callback function to capture the desired result. This is especially important with AJAX in the browser because when a remote request is made, it is indeterminate when the response will be received.  Below an example of making an AJAX call and alerting the response (or error):      $.ajax({          url: 'pcdsEmpRecords.php',          success: function (response) {              alert(response);          },          error: function (xhr) {              alert('Error! Status = ' + xhr.status);          }      });

What is the difference between jquery.size() and jquery.length?

Jquery.size() and jquery.length both returns the number of element found in the object. But, jquery.length is faster than jquery.size() because size() is a method but length is a property. Q

What is the use of jquery .each() function?

Basically, the jQuery .each() function is used to loop through each element of the target jQuery object. Very useful for multi element DOM manipulation, looping arrays and object properties.   Example:-  In this example alert box will open 3 times because dom contain 3 tags  <.ul>   Coffee   Milk   Soda  <.ul>

How to select combobox selected value and text using Jquery?

Example: var StateID = $("#StateCbx").val(); // Or you can use it $("#iStateID").val(); var StateName = $("#StateCbx option:selected").text(); alert("Selected combobox text is= " + StateName + " and value is= " + StateID);

When can you use jQuery?

JQuery can be used to perform   1.Call methods on specific events   2.Traverse the documents   3.For apply CSS   4.Manipulation purpose and   5.To add effects too.   6.For apply animations   7.For give atractive look (dialogbox etc)   8.For asynchronous calls ($.ajax())

Name any four paremeter of Jquery ajax method?

url : Specifies the URL to send the request to. Default is the current page   type : Specifies the type of request. (GET or POST)   data : Specifies data to be sent to the server   cache: A Boolean value indicating whether the browser should cache the requested pages. Default is true beforeSend(xhr): A function to run before the request is sent

What is Jquery $.ajax() method

The Jquery ajax() method is used to perform an AJAX (asynchronous HTTP) request. HTTP request can be get request or post request.