11.07.2015 Views

AJAX and PHP

AJAX and PHP

AJAX and PHP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

header('Expires: Fri, 25 Dec 1980 00:00:00 GMT'); // time in the pastheader('Last-Modified: ' . gmdate( 'D, d M Y H:i:s') . 'GMT');header('Cache-Control: no-cache, must-revalidate');header('Pragma: no-cache');header('Content-Type: text/html');// execute the client request <strong>and</strong> return the updated tasks listecho $myTasksList->Process($content, $action);?>9. Create a new file named drag-<strong>and</strong>-drop.js, <strong>and</strong> add this code to it:// holds an instance of XMLHttpRequestvar xmlHttp = createXmlHttpRequestObject();// when set to true, display detailed error messagesvar showErrors = true;// initialize the requests cachevar cache = new Array();// creates an XMLHttpRequest instancefunction createXmlHttpRequestObject(){// will store the reference to the XMLHttpRequest objectvar xmlHttp;// this should work for all browsers except IE6 <strong>and</strong> oldertry{// try to create XMLHttpRequest objectxmlHttp = new XMLHttpRequest();}catch(e){// assume IE6 or oldervar XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP");// try every prog id until one worksfor (var i=0; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!