This page has: A value which is read from the server via AJAX once per second and updated on the page A button which sends a toggle on/off action to the server via AJAX. 3 buttons which send a single button press action to the server via AJAX. The index.php file <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML […]
Category: AJAX
AJAX Send Only
AJAX Background Send Without Caring About Response function ajax_send_slider_value (slider_value_to_send) { AjaxRequest1Parameters = "action=do_something"; //<<<<<SET PARAMETER TO POST (id1=val1&id2=val2 for multiple parameters) AjaxRequest1 = new ajaxRequest(); AjaxRequest1.open("POST", "ajax.php", true); //<<<<<SET THE FILE TO POST THE REQUEST TO AjaxRequest1.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8"); AjaxRequest1.setRequestHeader("Content-length", AjaxRequest1Parameters.length); AjaxRequest1.setRequestHeader("Connection", "close"); //SEND THE AJAX REQUEST AjaxRequest1.send(AjaxRequest1Parameters); //Use (null) if there are no […]
AJAX Request For XML Values
A Working AJAX Request The HTML / Javascript <script> //Setup to make an HTTP POST Ajax request AjaxRequest1Parameters = "request_type=get_xml_values"; //<<<<<SET PARAMETER TO POST (id1=val1&id2=val2 for multiple parameters) AjaxRequest1 = new ajaxRequest(); AjaxRequest1.open("POST", "ajax.php", true); //<<<<<SET THE FILE TO POST THE REQUEST TO AjaxRequest1.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8"); AjaxRequest1.setRequestHeader("Content-length", AjaxRequest1Parameters.length); AjaxRequest1.setRequestHeader("Connection", "close"); AjaxRequest1.onreadystatechange = function() { //———————————————– […]
AJAX Request For Text
A Working AJAX Request The HTML / Javascript <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script> //*********************************** //*********************************** //********** AJAX HANDLERS ********** //*********************************** //*********************************** //<div id='ajax_area1'>THIS WILL BE REPLACED</div> //Setup to make an HTTP POST Ajax request AjaxRequest1Parameters = "request_type=get_image_to_show"; //<<<<<SET PARAMETER TO POST (id1=val1&id2=val2 for multiple parameters) AjaxRequest1 = new ajaxRequest(); AjaxRequest1.open("POST", "ajax.php", true); //<<<<<SET […]