ronieldom
ronieldom

Reputation: 1

Can Ajax be used without using jquery? Or do I need jquery for ajax?

I know that AJAX makes the page more interactive and real time, but do I need jQuery if I would be using AJAX?

Upvotes: 0

Views: 72

Answers (1)

Anik Islam Abhi
Anik Islam Abhi

Reputation: 25352

You don't need to jQuery in order to use AJAX. JavaScript has its own way.

Like this:

Initialization

var xmlhttp;
if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp = new XMLHttpRequest();
} else { // code for IE6, IE5
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}

Request Sending

xmlhttp.open("GET","demo_get.asp",true);
xmlhttp.send();

You can learn more here about javascript ajax here

Upvotes: 1

Related Questions