Javascript's Alternative To Jquery's Ajax Call. - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Javascript's Alternative To Jquery's Ajax Call. (1080 Views)
| Javascript's Alternative To Jquery's Ajax Call. by Karlebolu(op): 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(op): 12:57am On Mar 12, 2019 |
Febup: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 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 ![]() |
| Re: Javascript's Alternative To Jquery's Ajax Call. by stanliwise(m): 12:17pm On Mar 12, 2019 |
Karlebolu: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 |
Why I Switched Back To Jquery (and Why You’re Wrong For Not Doing It) • How do I access jQuery and bootstrap on local host? (solved) • Free HTML5, CSS3 And Basic Javascript (jquery) Training • 2 • 3 • 4
Job Opportunity In Portugal If You Have These Skills. • Vtu Api Provided Needed • Studying It Abroad
