showing results for - " 24 ajax javascript"
Ella
29 Nov 2018
1// For a plain JS solution, use these functions:
2
3function _GET_REQUEST(url, response) {
4  var xhttp;
5  if (window.XMLHttpRequest) {
6    xhttp = new XMLHttpRequest();
7  } else {
8    xhttp = new ActiveXObject("Microsoft.XMLHTTP");
9  }
10
11  xhttp.onreadystatechange = function() {
12    if (this.readyState == 4 && this.status == 200) {
13      response(this.responseText);
14    }
15  };
16
17  xhttp.open("GET", url, true);
18  xhttp.send();
19}
20
21function _POST_REQUEST(url, params, response) {
22  var xhttp;
23  if (window.XMLHttpRequest) {
24    xhttp = new XMLHttpRequest();
25  } else {
26    xhttp = new ActiveXObject("Microsoft.XMLHTTP");
27  }
28
29  xhttp.onreadystatechange = function() {
30    if (this.readyState == 4 && this.status == 200) {
31      response(this.responseText);
32    }
33  };
34
35  xhttp.open("POST", url, true);
36  xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
37  xhttp.send(params);
38}
39
40// and apply like this:
41_GET_REQUEST('http://someurl', (response) => {
42	// do something with variable response
43});
44_POST_REQUEST('http://someurl', 'paramx=y', (response) => {
45	// do something with variable response
46});
queries leading to this page
ajax jjavascript to ajaxjavascrip ajaxjquer ajaxjavascript ajax apijquery ajax javascriptjs ajax jquerywhat is ajax in jsjs ajax requestjavascript 24 ajax 28 29ajax using jsajax w3cajax javascrptis ajax javascriptjs 3f ajaxajax domjs ajazjs in ajaxajax request jsjavascript ajax methodwhat is js ajaxajaxa jsajax javasci ajax js 24 ajax in javascriptjaquery ajax 22 24 ajax 22ajax javascript framework ajax javascriptajax w3schoolajax javascript what isajax jsajax js request 287 29 define ajax how to improve a webpage using ajax 3f explain with example ajax api javascriptjavascript jquery ajax 24 ajax javascriptajax javascript tutorialis ajax jsajax in vanila jsajax in jsajax javasceriptajax javscriptjquery script with ajax functionajax syntax jsajax w3schoolsnodejs ajaxajax by w3schoolsuse ajax in htmlajax scriptapi javascript ajaxajax js jqueryajax modejavascript use ajaxajax jaavscriptjs ajax when ajax data jsjs what is ajaxjavascript ajax nedirraphaeljs ajaxwaht is ajax javascriptajax jsjs ajaxajax in jasplain js ajaxjquery ajaxajax jscriptjavscript ajaxajax keyword referenceajax programmingjavascript ajax jqueryjavascirp ajaxajax in javascriptwhat is ajax javascript 24 ajax in jjsajax in javascript example 24 ajax 28 7bajax latest versionhow to ajaxajax plain jsjquery ajaxframework javascript ajaxjavascrip 24 ajax ajax javascriptjavascript e2 80 93 ajaxjavascript ajaxhow to use ajax jsajax definition jsajax javascript jqueryjsf ajaxajax javascirptjavascript ajaxintro to ajaxwhat is 24 ajax in javascriptjs ajaxoperationjavascript ajaxajax basic jsajax javascript libraryajax jahow ajax js worksvanilla js ajaxjavascritp ajaxajaxq javascript ajax javascript jqueryajax jquery javascriptajax for javascriptajax javascripttu ajax 28 7b 7d 29 24 ajaxwhat is ajax jslearn ajaxjs api ajaxajax jquerjavascript 24 ajaxjavascript ajax request 24 ajax javascript