Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,195,599 members, 7,958,840 topics. Date: Thursday, 26 September 2024 at 04:59 AM

Javascript's Alternative To Jquery's Ajax Call. - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Javascript's Alternative To Jquery's Ajax Call. (975 Views)

How To Create A Simple Web Popup Notifier Using Vanilla Javascript And Jquery / Free HTML5, CSS3 And Basic Javascript (jquery) Training / Free Online Training For Html/css, Javascript, Jquery, Mysql, Php, Java, Android (2) (3) (4)

(1) (Reply) (Go Down)

Javascript's Alternative To Jquery's Ajax Call. by Karlebolu(m): 5:53pm On Mar 11, 2019
I am trying to implement a snippet of code to create a like and dislike system using PHP, MYSQL and JS via http://codewithawa.com/posts/like-dislike-system-with-php-and--mysql

Everything over there works fine but I am trying to make the ajax call via JavaScript itself and not the Jquery library. Someone should help please!


Also, a $_POST['action'] super global was addressed within the PHP codes but a form tag that should refer to it was not created in the HTML codes, I guess it has to do with the JQuery ajax. Right?
Re: Javascript's Alternative To Jquery's Ajax Call. by Nobody: 9:05pm On Mar 11, 2019
Why don't you want to use the Jquery AJAX library it's much easier to use than the JavaScript Method
Re: Javascript's Alternative To Jquery's Ajax Call. by Karlebolu(m): 12:57am On Mar 12, 2019
Febup:
Why don't you want to use the Jquery AJAX library it's much easier to use than the JavaScript Method

I just really want to know how its done in JavaScript. Sadly enough, all alternatives I've seen are all written in jquery.

I just weak..
Re: Javascript's Alternative To Jquery's Ajax Call. by Nobody: 1:05am On Mar 12, 2019
Karlebolu:


I just really want to know how its done in JavaScript. Sadly enough, all alternatives I've seen are all written in jquery.

I just weak..

I tried it once before with JavaScipt but since l found out about Jquery AJAX l have never gone back to using JavaScript AJAX
Re: Javascript's Alternative To Jquery's Ajax Call. by etoluw: 11:00am On Mar 12, 2019
this is a simple tutorial


// create XMLHttpRequest object
ajR = new XMLHttpRequest();


// set the function that will receive the response
//here sT refers to the document element u want to populate with the result

ajR.onreadystatechange = ajaxfunc;

function ajaxfunc() {
if(ajR.readyState == 4) {
if(ajR.status == 200){

sT.innerHTML = ajR.responseText;

}
}
}




//then finally open and send the request
//this request is sent using "GET" request to url

ajR.open("GET", $url, true);
ajR.send();



if you need further explanation u can send whatsapp message(08129615641)
Re: Javascript's Alternative To Jquery's Ajax Call. by KazukiIto(m): 12:07pm On Mar 12, 2019
Or you use fetch undecided
Re: Javascript's Alternative To Jquery's Ajax Call. by stanliwise(m): 12:17pm On Mar 12, 2019
Karlebolu:
I am trying to implement a snippet of code to create a like and dislike system using PHP, MYSQL and JS via http://codewithawa.com/posts/like-dislike-system-with-php-and--mysql

Everything over there works fine but I am trying to make the ajax call via JavaScript itself and not the Jquery library. Someone should help please!


Also, a $_POST['action'] super global was addressed within the PHP codes but a form tag that should refer to it was not created in the HTML codes, I guess it has to do with the JQuery ajax. Right?
Ehmm Have you done it already or should I contribute too?
Re: Javascript's Alternative To Jquery's Ajax Call. by resosdigital(m): 1:31pm On Mar 12, 2019
I would recommend you use axios http library. It isn't based on jquery so can work well with vanilla js or any other framework

(1) (Reply)

Compiler Construction/ Building A Programming Language / Has Anyone Here Used Nestjs? What's Your Experience / .

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 14
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.