Wednesday, September 25, 2013
[mysql]Managing Hierarchical Data in MySQL
Date:20130926
Trees In The Database - Advanced data structures
http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/
http://www.slideshare.net/quipo/trees-in-the-database-advanced-data-structures
Friday, September 20, 2013
xmlhttprequest
Date:20130921 if (typeof XMLHttpRequest === "undefined") { XMLHttpRequest = function () { try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e) {} try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (e) {} try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} throw new Error("This browser does not support XMLHttpRequest."); }; } xhr=new XMLHttpRequest(); //xhr.open('GET', 'somepage.xml', true); xhr.open('POST', 'somewhere', true); //xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhr.onload = function () { // do something to response console.log(this.responseText); }; //xhr.send(null); xhr.send('user=person&pwd=password&organization=place&requiredkey=key'); Reference: http://en.wikipedia.org/wiki/XMLHttpRequest http://www.w3schools.com/xml/xml_http.asp
Wednesday, September 11, 2013
[php]upload file with cross domain
this is the only way I can find to post data with cross domain switch ($_SERVER['HTTP_ORIGIN']) { case 'http://pro.sppp.com': case 'https://pro.sppp.com': header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']); header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS'); header('Access-Control-Max-Age: 1000'); header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With'); break; }
Subscribe to:
Posts (Atom)