jQuery AJAX

How jQuery AJAX Methods works…

AJAX is the technic of exchanging data with a server and updating parts of a web page — without reloading the whole page.

Example of $.ajax():

$.ajax({type : “POST”, url : “example.txt”, dataType: “xml/html/text/script/json”,success : function(data){console.log(data);},error : function(res) {console.log(JSON.stringify(res));}});

Excample of $.get():

Syntax — $.get(URL,data,function(data,status),dataType)

$.get(“demo_test.asp”, function(data, status){alert(“Data: “ + data + “\nStatus: “ + status);});

Example of $.post():

$.post(URL,data,function(data,status),dataType)

var txt = $(“input”).val();$.post(“demo_ajax_gethint.asp”, {suggest: txt}, function(result){$(“span”).html(result);});

Other Methods:

Serialize(), serializeArray()

--

--

--

Keep Your Memories Alive

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Power of Tuples

JavaScript/TypeScript Array Filter

Working with Palindromes in JavaScript and Python

Understanding JavaScript Objects: What They Mean and How to Create Them

8 Powerful Reasons Why React JS is the Best Applications Development Platform

Best Applications Development

JavaScript: Valid Anagram Challenge

React — Integrating with Third-Party Libraries

Prepping for Capstone

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Himalaya Pagada

Himalaya Pagada

Keep Your Memories Alive

More from Medium

Extensive code

LifeLoans Login

Top 6 Javascript Chart Libraries

How To Use CSS (Cascading Style Sheets) To Style HTML

CSS Style Sheet To Style HTML