Ricky Barnes has Published 119 Articles

How to write a custom jQuery plugin?

Ricky Barnes

Ricky Barnes

Updated on 12-Jun-2020 09:00:13

267 Views

To create a jQuery plugin, first create a file named jquery-demoplugin.js with the following code. This is our plugin code. Here, demoplugin is the name of our plugin. You can add any name to your custom plugin −(function ( $ ) {    $.fn.demoplugin = function( options ) {     ... Read More

What is the difference between jQuery.load() and jQuery.ajax() methods in jQuery?

Ricky Barnes

Ricky Barnes

Updated on 17-Feb-2020 07:23:14

531 Views

jQuery ajax() methodThe jQuery.ajax( options ) method loads a remote page using an HTTP request. $.ajax() returns the XMLHttpRequest that it creates. In most cases you won't need that object to manipulate directly, but it is available if you need to abort the request manually.Here is the description of all ... Read More

What is the difference between jQuery.load() and jQuery.get() methods in jQuery?

Ricky Barnes

Ricky Barnes

Updated on 17-Feb-2020 07:17:43

610 Views

jQuery load() methodThe load( url, data, callback ) method loads data from the server and places the returned HTML into the matched element.Here is the description of all the parameters used by this method −url − A string containing the URL to which the request is sent.data − This optional parameter represents ... Read More

What is the difference between jQuery.post() and jQuery.get() methods in jQuery?

Ricky Barnes

Ricky Barnes

Updated on 17-Feb-2020 07:13:59

277 Views

jQuery post() methodThe jQuery.post( url, [data], [callback], [type] ) method loads a page from the server using a POST HTTP request.Assuming we have following PHP content in result.php file, ExampleThe following is the code snippet showing the usage of this method −                ... Read More

What does jQuery.serialize() method do in jQuery?

Ricky Barnes

Ricky Barnes

Updated on 17-Feb-2020 07:07:40

215 Views

The serialize() method serializes a set of input elements into a string of data. Let’s say we have the following PHP content in serialize.php file −ExampleThe following is the code snippet showing the usage of this method −                        ... Read More

How to put a complete HTML page in a div using jQuery?

Ricky Barnes

Ricky Barnes

Updated on 17-Feb-2020 07:06:12

634 Views

To put complete HTML page in a div using jQuery, use the load() method. Firstly, add the web page you want to add.Here’s the code for new.html −     Heading 1 Demo text ExampleNow, the code for the HTML file which adds the above page, ... Read More

How to use jQuery.getJSON to load JSON file in jQuery?

Ricky Barnes

Ricky Barnes

Updated on 17-Feb-2020 07:04:28

1K+ Views

The jQuery.getJSON( url, [data], [callback] ) method loads JSON data from the server using a GET HTTP request.Assuming we have the following JSON content in result.json file −{ "name": "Amy", "age" : "24", "sex": "female" }ExampleThe following is the code snippet showing the usage of this method −      ... Read More

How to use jQuery.getScript() method to load external js files?

Ricky Barnes

Ricky Barnes

Updated on 17-Feb-2020 07:03:25

3K+ Views

The jQuery.getScript( url, [callback] ) method loads and executes a JavaScript file using an HTTP GET request.Here is the description of all the parameters used by this method −url − A string containing the URL to which the request is sentcallback − This optional parameter represents a function to be executed whenever ... Read More

How to use jQuery.serializeArray() method to serialize data?

Ricky Barnes

Ricky Barnes

Updated on 17-Feb-2020 07:02:06

629 Views

The serializeArray( ) method serializes all forms and form elements like the .serialize() method but returns a JSON data structure for you to work with.Assuming we have following PHP content in serialize.php file −ExampleThe following is an example showing the usage of this method −Live Demo       ... Read More

How do I access values created by serializeArray in jQuery?

Ricky Barnes

Ricky Barnes

Updated on 17-Feb-2020 07:00:20

643 Views

To access values creates by serializeArray, use the serializeArray( ) method. The serializeArray( ) method serializes all forms and form elements like the .serialize() method but returns a JSON data structure for you to work with.Let’s say we have the following PHP content in serialize.php file −The following is an example ... Read More

Advertisements