Writing To The Browser Deveoper Console Outputting a Key & Value array to the console
All posts by
Basic AJAX Working Example
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 […]
Setup for iOS web app
Setting Page As An iOS Web App You can setup a few meta tags to tell iOS that your site can be added to the Home Screen as a web app. Once launched from there, all of the Safari elements are hidden. <!– DON'T LET USER ADJUST SIZE –> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> <!– […]
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 […]
Replacing HTML / Manipulating HTML
Replace HTML Code The HTML <div id='status_area1'>THIS WILL BE REPLACED</div><br /> The Javascript document.getElementById("status_area1").innerHTML = "Helle"; Image Source document.getElementById("my_image_id").src = "some_iamge.php";
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() { //———————————————– […]
Element Siblings
How to specify the sibling of an element $('#speed_slider').siblings('.ui-slider-vertical').bind('touchstart', function () { //do something });
ID vs Class
ID This following is function: $('#SomePageElementId').live('vmousedown', function() { //Do something }); is based on an element ID like this: <div id="SomePageElementId"> … </div> Class But you can use a class name instead of an ID, with the function instead like this: $('.SomePageElementClass').live('vmousedown', function() { //Do something }); based on an element class like this: <div […]
Is An Element Touched
$('#your-element-id').live('vmousedown', function() { alert("Down") }); $('#your-element-id').live('vmouseup', function() { alert("Up") });
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 […]