Category: 1. jQuery Advance

  • Including jQuery Before Other Libraries

    The above solutions to avoid conflicts rely on jQuery is being loaded after prototype.js is loaded. However, if you include jQuery before other libraries, you may use full name jQuery in your jQuery code to avoid conflicts without calling the jQuery.noConflict(). But in this scenario the $ will have the meaning defined in the other library. Example

  • jQuery No-Conflict Mode

    Using jQuery with Other JavaScript Libraries As you already know, jQuery uses the dollar sign ($) as a shortcut or alias for jQuery. Thus, if you use another JavaScript library that also uses the $ sign as a shortcut, along with the jQuery library on the same page, conflicts could occur. Fortunately, jQuery provides a special method named noConflict() to…

  • Performing POST Request with AJAX using jQuery

    POST requests are identical to GET requests in jQuery. So, generally which method you should use either $.get() or $.post() is basically depends on the requirements of your server-side code. If you have large amount of data to be transmitted (e.g. form data) you need to use POST, because GET has a stringent limit on the data transfer. Example…

  • Performing GET Request with AJAX using jQuery

    The following example uses the jQuery $.get() method to make an Ajax request to the “date-time.php” file using HTTP GET method. It simply retrieves the date and time returned from the server and displays it in the browser without refreshing the page. Example Here’s our “date-time.php” file that simply output the current date and time of the…

  • jQuery Ajax GET and POST Requests

    jQuery $.get() and $.post() Methods The jQuery’s $.get() and $.post() methods provide simple tools to send and retrieve data asynchronously from a web server. Both the methods are pretty much identical, apart from one major difference — the $.get() makes Ajax requests using the HTTP GET method, whereas the $.post() makes Ajax requests using the HTTP POST method. The basic syntax of these methods can be given with: $.get(URL, data, success);   —Or—   $.post(URL, data, success);…

  • jQuery Ajax Load

    jQuery load() Method The jQuery load() method loads data from the server and place the returned HTML into the selected element. This method provides a simple way to load data asynchronous from a web server. The basic syntax of this method can be given with: $(selector).load(URL, data, complete); The parameters of the load() method has the following meaning: Let’s put this method into…

  • jQuery Ajax

    What is Ajax Ajax stands for Asynchronous Javascript And Xml. Ajax is just a means of loading data from the server to the web browser without reloading the whole page. Basically, what Ajax does is make use of the JavaScript-based XMLHttpRequest object to send and receive information to and from a web server asynchronously, in the background, without interfering…

  • jQuery filter() Method

    The jQuery filter() method can take the selector or a function as its argument to filters the set of matched elements based on a specific criteria. The supplied selector or function to the filter() method is tested against each element in the set of matched elements and all the elements that matching the supplied selector or pass the function’s test will…

  • jQuery Filtering

    Filtering the Elements Selection jQuery provides several methods such as filter(), first(), last(), eq(), slice(), has(), not(), etc. that you can use to narrow down the search for elements in a DOM tree. jQuery first() Method The jQuery first() method filters the set of matched elements and returns the first element from the set. The following example will only highlight the first <li> element within the <ul> element by adding…

  • jQuery nextUntil() Method

    The jQuery nextUntil() method is used to get all the following siblings up to but not including the element matched by the selector. In simple words we can say it returns all the next siblings elements between two given elements in a DOM hierarchy. The following example will highlight all the following sibling elements of the <h1> element excluding…