Found 766 Articles for JQuery

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

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

2K+ 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 the data is loaded successfully.Assuming we have following JavaScript content in result.js file −function CheckJS(){    alert("This is JavaScript"); }ExampleThe following is the code snippet showing the usage of this method −                              $(document).ready(function() {   ... Read More

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

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

495 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           The jQuery Example                              $(document).ready(function() {                         $("#driver").click(function(event){                             ... Read More

How do I access values created by serializeArray in jQuery?

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

514 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 showing the usage of this method −ExampleLive Demo           The jQuery Example                              $(document).ready(function() {                         $("#driver").click(function(event){     ... Read More

How to get value from serialized array in jQuery?

Ricky Barnes
Updated on 17-Feb-2020 06:56:19

3K+ Views

To get value from serialized array, use th 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 showing the usage of this method:ExampleLive Demo           The jQuery Example                              $(document).ready(function() {                         $("#driver").click(function(event){     ... Read More

How jQuery.getJSON() method loads JSON data in jQuery?

Amit D
Updated on 17-Feb-2020 06:54:47

478 Views

The jQuery.getJSON( url, [data], [callback] ) method loads JSON data from the server using a GET HTTP request.Here is the description of all the parameters used by this method −url − A string containing the URL to which the request is sentdata − This optional parameter represents key/value pairs that will be sent to the server.callback − This optional parameter represents a function to be executed whenever the data is loaded successfully.Let’s say we have the following JSON content in result.json file −{   "name": "David",   "age" : "25",   "sex": "male" }The following is a code snippet showing the usage of ... Read More

How to retrieve data from JSON file using jQuery and Ajax?

Amit D
Updated on 17-Feb-2020 06:53:11

7K+ Views

To retrieve data from JSON file using jQuery and Ajax, use the jQuery.getJSON( url, [data], [callback] )The jQuery.getJSON( url, [data], [callback] ) method loads JSON data from the server using a GET HTTP request.Here is the description of all the parameters used by this method −url − A string containing the URL to which the request is sentdata − This optional parameter represents key/value pairs that will be sent to the server.callback − This optional parameter represents a function to be executed whenever the data is loaded successfully.Let’s say we have the following JSON content in result.json file −{ "name": "John", "age" : ... Read More

How to load JSON data using jQuery?

Amit D
Updated on 17-Feb-2020 06:51:09

16K+ Views

To load JSON data using jQuery, use the getJSON() and ajax() method. The jQuery.getJSON( ) method loads JSON data from the server using a GET HTTP request.Here is the description of all the parameters used by this method −url − A string containing the URL to which the request is sentdata − This optional parameter represents key/value pairs that will be sent to the server.callback − This optional parameter represents a function to be executed whenever the data is loaded successfully.Add your JSON content in result.json file −{ "name": "Amit", "age" : "27", "sex": "male" }The following is a code snippet showing the ... Read More

How to set background image in CSS using jQuery?

Amit D
Updated on 11-Dec-2019 08:20:50

760 Views

To set the background image using jQuery, use the jQuery css() method.ExampleUse the background-image property to add background image to the web page.Live Demo $(document).ready(function(){    $(".bg").css("background-image", "url('/css/images/css.jpg')"); });

How to load external website into an