{"id":210402,"date":"2014-01-27T11:01:03","date_gmt":"2014-01-27T07:01:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=210402"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=210402","title":{"rendered":"<span class=\"post_title\">\u041f\u0438\u0448\u0435\u043c \u0431\u043b\u043e\u0433 \u0441 Full-Fjax \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0435\u0439 \u0441\u0430\u043c\u0438 \u0438 \u0441 \u043d\u0443\u043b\u044f. \u0427\u0430\u0441\u0442\u044c 1<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e full-ajax \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u0433\u0430. \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0443-\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442.<\/p>\n<p>  \u0412 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0440\u0430\u0437 \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044f \u0445\u0430\u0431\u0440\u0430\u0445\u0430\u0431\u0440, \u043c\u0435\u043d\u044f \u043f\u043e\u0441\u0435\u0442\u0438\u043b\u0430 \u043c\u044b\u0441\u043b\u044c \u043d\u0430\u0432\u0430\u044f\u0442\u044c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u0432\u043e\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043a\u0430\u0437\u0430\u0432 \u043f\u0438\u0446\u0446\u0443 \u0438 \u0432\u043e\u043e\u0440\u0443\u0436\u0438\u0432\u0448\u0438\u0441\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u0440\u0443\u0436\u043a\u043e\u0439 \u0447\u0430\u044f \u2014 \u043d\u0430\u0447\u0430\u043b \u0434\u0443\u043c\u0430\u0442\u044c. <br \/>  \u042f \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u043e\u0432 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043b\u043e\u0433 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"http:\/\/habrahabr.ru\/post\/135619\/\"> Fat-Free Framework<\/a>, <a href=\"http:\/\/habrahabr.ru\/post\/51921\/\">symfony<\/a>, <a href=\"http:\/\/habrahabr.ru\/post\/192522\/\">Zend<\/a> \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435\u2026 \u0418 \u0442\u0443\u0442 \u0443 \u043c\u0435\u043d\u044f \u0432 \u0433\u043e\u043b\u043e\u0432\u0435 \u0437\u0430\u043a\u0440\u0430\u043b\u0430\u0441\u044c \u0438\u0434\u0435\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043b\u043e\u0433 \u0441 ajax \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0435\u0439. \u0410 \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0438 \u043d\u0435\u0442? \u041d\u0430 \u0445\u0430\u0431\u0440\u0435 \u044f \u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043b\u043e\u0445\u043e \u0438\u0441\u043a\u0430\u043b\u2026<br \/>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u0442 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u044f \u0440\u0435\u0448\u0438\u043b \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u0435\u0439. \u0425\u043e\u0447\u0443 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0412\u0430\u0448\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u043c\u043e\u0439 <s>\u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0441\u0442 \u043d\u0430 \u0445\u0430\u0431\u0440\u0435<\/s>, \u0434\u0430 \u0438 \u043f\u0438\u0441\u0430\u0440\u044c \u0438\u0437 \u043c\u0435\u043d\u044f \u043d\u0438\u043a\u0443\u0434\u044b\u0448\u043d\u044b\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u0447\u0442\u043e \u043d\u0435 \u0442\u0430\u043a, \u0438\u0437\u0432\u0438\u043d\u044f\u0439\u0442\u0435. <\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c.<br \/>  <a name=\"habracut\"><\/a><br \/>  <a href=\"http:\/\/ajax.intouch.pro\/#!\/\">\u0414\u0435\u043c\u043e<\/a>.<\/p>\n<p>  \u0421\u0441\u044b\u043b\u043a\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c \u0431\u043b\u043e\u0433\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430: <\/p>\n<p>  <code>http:\/\/localhost\/#!\/ <\/code><br \/>  <code>http:\/\/localhost\/#!\/page<\/code><br \/>  <code>http:\/\/localhost\/#!\/another-apge<\/code><\/p>\n<p>  \u0422\u0430\u043a\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0412\u044b \u043c\u043e\u0433\u043b\u0438 \u0432\u0438\u0434\u0435\u0442\u044c \u0432 \u0442\u0432\u0438\u0442\u0442\u0435\u0440\u0435.<\/p>\n<p>  \u0412 \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u0435\u0440\u0441\u0442\u043a\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u0443\u043b\u044c\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u0433\u0430. <br \/>  \u042f \u043d\u0430\u0434 \u0434\u0438\u0437\u0430\u0439\u043d\u043e\u043c \u0437\u0430\u043c\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0441\u0442\u0430\u043b, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u043e\u0441\u0442 \u043d\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0435\u0437 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435:<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html PUBLIC &quot;-\/\/W3C\/\/DTD XHTML 1.0 Strict\/\/EN&quot; &quot;http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-strict.dtd&quot;&gt; &lt;html xmlns=&quot;http:\/\/www.w3.org\/1999\/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt; &lt;head&gt;     &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html; charset=UTF-8&quot; \/&gt;     &lt;meta name=&quot;description&quot; content=&quot;&quot; \/&gt;     &lt;meta name=&quot;keywords&quot; content=&quot;&quot; \/&gt;     &lt;meta name=&quot;generator&quot; content=&quot;&quot; \/&gt;     &lt;title&gt;My thirst Ajax Blog&lt;\/title&gt;     &lt;script type=&quot;text\/javascript&quot; src=&quot;inc\/ajax.js&quot;&gt;&lt;\/script&gt;     &lt;script src=&quot;\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.10.2\/jquery.min.js&quot;&gt;&lt;\/script&gt;     &lt;link type=&quot;text\/css&quot; rel=&quot;stylesheet&quot; href=&quot;style.css&quot;\/&gt; &lt;\/head&gt; &lt;body&gt;     &lt;div id=&quot;content&quot;&gt;         &lt;h1&gt;&lt;a href=&quot;\/#!\/&quot;&gt;\u041c\u043e\u0439 \u0431\u043b\u043e\u0433&lt;\/a&gt; &lt;span&gt;v1.0&lt;\/span&gt;&lt;\/h1&gt;         &lt;p&gt;             &lt;a href=&quot;\/#!\/&quot;&gt;Home page&lt;\/a&gt;             &lt;a href=&quot;\/#!\/about&quot;&gt;About page&lt;\/a&gt;         &lt;\/p&gt;         &lt;hr \/&gt;         &lt;div id=&quot;posts&quot;&gt;&lt;\/div&gt;     &lt;\/div&gt;     &lt;div id=&quot;preloader&quot;&gt;         &lt;div style=&quot;position: absolute; left: 50%; margin-left: -50px; top: 50%; margin-top: -50px;&quot;&gt;                 &lt;img src=&quot;loading.gif&quot; title=&quot;Loading...&quot; alt=&quot;Loading..&quot; \/&gt;         &lt;\/div&gt;     &lt;\/div&gt; &lt;\/body&gt; &lt;script&gt;     $(document).ready(function(){         ajax.onLoadStart = function(){             $('#preloader').show();         };         ajax.onLoadEnd = function(){             $('#preloader').hide();         };         ajax.init();     }); &lt;\/script&gt; &lt;\/html&gt;  <\/code><\/pre>\n<p>  \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u043d\u0430 \u0447\u0442\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u044d\u0442\u043e \u044f\u0432\u0430\u0441\u043a\u0440\u0438\u043f\u0442 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0443 ajax-\u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044e \u043f\u043e \u0431\u043b\u043e\u0433\u0443.<\/p>\n<p>  \u0427\u0443\u0442\u044c \u043d\u0435 \u0437\u0430\u0431\u044b\u043b \u043f\u0440\u043e \u0441\u0442\u0438\u043b\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 style.css:<\/p>\n<pre><code class=\"css\">html, body, div, ul { \tmargin: 0; \tpadding: 0; }  body {     color: #262626; \tbackground: #f4f4f4; \tfont: normal 12px\/18px Verdana, sans-serif; }  #content { \tposition: absolute; \twidth: 800px; \tright: 0px; \tleft: 0px; \tmargin: 40px auto 0 auto; \tpadding: 0 60px 30px 60px; \tborder: solid 1px #cbcbcb; \tbackground: #fafafa; \t-moz-box-shadow: 0px 0px 10px #cbcbcb; \t-webkit-box-shadow: 0px 0px 10px #cbcbcb; }  h1 { \tmargin: 30px 0 15px 0; \tfont-size: 30px; \tfont-weight: bold; \tfont-family: Arial; }  h1 span { \tfont-size: 50%; \tletter-spacing: -0.05em; }  hr { \tborder: none; \theight: 1px; line-height: 1px; \tbackground: #E5E5E5; \tmargin-bottom: 20px; \tpadding: 0; }  p { \tmargin: 0; \tpadding: 7px 0; }  a { \toutline: none; }  link { \tcolor: #000; \ttext-decoration: none; } a:visited, a:link { \tcolor: #000; \ttext-decoration: none; } a:hover { \tcolor: #000; \ttext-decoration: none; } a:active { \tcolor: #000; \ttext-decoration:none; }  #preloader{     display: none;     position:fixed;     z-index: 777;     background:none repeat scroll 0 0 #000000;     cursor:wait;     width:100%;     height:100%;     top:0;     left:0;     opacity:0.7;     -moz-opacity: 0.5;     -khtml-opacity: 0.5; } <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0438\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435\u2026 \u0424\u0430\u0439\u043b ajax.js:<\/p>\n<pre><code class=\"javascript\">var ajax = {      \/**      * \u0421\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 ajax \u0437\u0430\u043f\u0440\u043e\u0441\u044b.      *\/     ajSrc: 'ajax.php',     ajUrl: '',     \/**      * \u0424\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043d\u0430\u0447\u0430\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438      *\/     onLoadStart: function(){},     \/**      * \u0424\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0430      *\/     onLoadEnd: function(){},      \/**      * \u041c\u044b \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0443\u0440\u043b\u043e\u0432 \u0432\u0438\u0434\u0430 #!\/my-url.      * \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0430\u0434\u0440\u0435\u0441\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0443\u0440\u043b\u0430 \u0442\u0430\u043a\u043e\u043c\u0443 \u0432\u0438\u0434\u0443 \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0447\u0435\u0433\u043e, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441.      * @return {Boolean}      *\/     checkAjaxNav: function(){         hash    = document.location.hash;         navInd  = hash.substr(0, 3);          if(navInd != '#!\/'){             this.ajUrl = hash;             return false;         }          hash = hash.substr(2);         if( hash != this.ajUrl ){             this.ajUrl = hash;             this.sendData(hash);         }         return true;     },      \/**      * \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440      * @param ajaxData      *\/     sendData: function(ajaxData){         this.onLoadStart();         $.post(this.ajSrc, {             ajax_data: ajaxData         }, function( data ){             ajax.receiveData(data);         }, 'json');     },     \/**      * \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e.      * @param data      *\/     receiveData: function( data ){         for( var key in data ){             var val = data[key];             if( 'eval' == key )                 eval(val);             else                 $(key).html(val);         }          this.onLoadEnd();     },      \/**      * \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0443 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044e      *\/     init: function(){         this.checkAjaxNav();         $(window).bind('hashchange', function(){             ajax.checkAjaxNav();         });     } };  <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <code>sendData()<\/code> \u043d\u0430 \u043d\u0430\u0448 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a <code>ajax.php<\/code>.<br \/>  \u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u0437\u0430\u043f\u0440\u043e\u0441 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>onLoadStart()<\/code> \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0447\u0442\u043e-\u0442\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0444\u043e\u0440\u043c \u0438 \u0442.\u0434. <\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>receiveData()<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>onLoadEnd()<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0448 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0440\u0443\u0433\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0435-\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u043e\u0440\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u0442.\u0434<\/p>\n<p>  \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a <code>ajax.php<\/code><\/p>\n<pre><code class=\"php\">&lt;?php error_reporting(0);  define(&quot;coolBlogCms&quot;, true); define(&quot;DIR&quot;, getcwd() . &quot;\/&quot;); define(&quot;INC&quot;, DIR . &quot;inc\/&quot;);  require_once INC . &quot;myAjax.php&quot;;  $blog = new myAjax();  if( isset($_POST['ajax_data']) ){     $ew = $blog-&gt;receiveData();      switch($ew[1]){         case 'about':             $html['#posts'] = &lt;&lt;&lt;HTML     This is about page. Loaded from my ajax cms. HTML;             break;         default:             $html['#posts'] = &lt;&lt;&lt;HTML     This is the main page of my cool blog. Thank's for reading. HTML;              break;     }      $blog-&gt;sendData($html); }  ?&gt;  <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0434\u0430\u043d\u043d\u044b\u0435. \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0432\u0435\u0440\u0445 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e. <br \/>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>receiveData()<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 POST-\u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0410 <code>sendData()<\/code> \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435. \u0421\u0435\u0439\u0447\u0430\u0441 \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e json, \u043d\u043e \u0434\u0430\u043b\u044c\u0448\u0435 \u043c\u044b \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u043c \u0435\u0449\u0435 \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c. <br \/>  \u0414\u0430\u043d\u043d\u044b\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043a\u043b\u044e\u0447\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u043b\u0438 #id \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0430 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435, \u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u2014 \u043d\u0435\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<br \/>  \u0422\u0430\u043a \u0436\u0435 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c js \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>eval()<\/code><br \/>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"php\">$arr = array();     $arr['#first_div'] = &quot;First div content&quot;;     $arr['#second_div'] = &quot;Second div content&quot;;     $arr['.another_divs'] = &quot;Content that will be placed to several divs&quot;;      $blog-&gt;sendData($arr, &quot;alert('Hello world !');&quot;); <\/code><\/pre>\n<p>  myAjax.php<\/p>\n<pre><code class=\"php\">&lt;?php  if(!defined(&quot;coolBlogCms&quot;))     exit;  class myAjax{      \/**      * @return bool      *\/     public function receiveData(){         if( !isset($_POST['ajax_data']) ){             return false;         }          $data = $_POST['ajax_data'];         $data = explode('\/', $data);         unset( $_POST['ajax_data'] );          return $data;     }      \/**      * @param $data      * @param string $eval      * @return bool      *\/     public function sendData( $data, $eval = '' ){         if(!$data && !$eval)             return false;          if( !headers_sent() ){             header('Content-Type: application\/json; charset=utf-8' );         }          echo json_encode( array_merge($data, array('eval' =&gt; $eval)) );         return true;     } }  <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0438 \u0432\u0441\u0435. \u0415\u0441\u043b\u0438 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435, \u0442\u043e \u044f \u0441 \u0440\u0430\u0434\u043e\u0441\u0442\u044c\u044e \u043d\u0430\u043f\u0438\u0448\u0443 \u0432\u0442\u043e\u0440\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438. \u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438:  <\/p>\n<ul>\n<li> \u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0411\u0414 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u043e\u0432, \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432<\/li>\n<li> \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0444\u043e\u0440\u043c<\/li>\n<li> * \u0414\u043e\u043f\u0438\u043b\u0438\u0432\u0430\u043d\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430<\/li>\n<li> \u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u0434\u0430<\/li>\n<\/ul>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0411\u0414 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043a\u0430\u043a \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u0430\u044f MySQL, \u0438\u043b\u0438 MongoDb. <br \/>  * \u041f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 xml \u0438 plain \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0412\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043f\u043e\u0436\u0435\u043b\u0430\u043d\u0438\u044f, \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0431\u044b \u0412\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0432\u0438\u0434\u0435\u0442\u044c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u2014 \u043f\u0438\u0448\u0438\u0442\u0435. <br \/>  \u0415\u0441\u043b\u0438 \u0443 \u0412\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0435 \u043c\u043d\u0435\u043d\u0438\u0435, \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0438 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435 \u2014 \u043f\u0438\u0448\u0438\u0442\u0435, \u0431\u0443\u0434\u0443 \u0440\u0430\u0434.<\/p>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u0440\u0430\u0434 \u0431\u0443\u0434\u0443 \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u0440\u0438\u0442\u0438\u043a\u0435. \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/210402\/\"> http:\/\/habrahabr.ru\/post\/210402\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e full-ajax \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u0433\u0430. \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0443-\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442.<\/p>\n<p>  \u0412 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0440\u0430\u0437 \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044f \u0445\u0430\u0431\u0440\u0430\u0445\u0430\u0431\u0440, \u043c\u0435\u043d\u044f \u043f\u043e\u0441\u0435\u0442\u0438\u043b\u0430 \u043c\u044b\u0441\u043b\u044c \u043d\u0430\u0432\u0430\u044f\u0442\u044c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u0432\u043e\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043a\u0430\u0437\u0430\u0432 \u043f\u0438\u0446\u0446\u0443 \u0438 \u0432\u043e\u043e\u0440\u0443\u0436\u0438\u0432\u0448\u0438\u0441\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u0440\u0443\u0436\u043a\u043e\u0439 \u0447\u0430\u044f \u2014 \u043d\u0430\u0447\u0430\u043b \u0434\u0443\u043c\u0430\u0442\u044c. <br \/>  \u042f \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u043e\u0432 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043b\u043e\u0433 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"http:\/\/habrahabr.ru\/post\/135619\/\"> Fat-Free Framework<\/a>, <a href=\"http:\/\/habrahabr.ru\/post\/51921\/\">symfony<\/a>, <a href=\"http:\/\/habrahabr.ru\/post\/192522\/\">Zend<\/a> \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435\u2026 \u0418 \u0442\u0443\u0442 \u0443 \u043c\u0435\u043d\u044f \u0432 \u0433\u043e\u043b\u043e\u0432\u0435 \u0437\u0430\u043a\u0440\u0430\u043b\u0430\u0441\u044c \u0438\u0434\u0435\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043b\u043e\u0433 \u0441 ajax \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0435\u0439. \u0410 \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0438 \u043d\u0435\u0442? \u041d\u0430 \u0445\u0430\u0431\u0440\u0435 \u044f \u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043b\u043e\u0445\u043e \u0438\u0441\u043a\u0430\u043b\u2026<br \/>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u0442 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u044f \u0440\u0435\u0448\u0438\u043b \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u0435\u0439. \u0425\u043e\u0447\u0443 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0412\u0430\u0448\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u043c\u043e\u0439 <s>\u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0441\u0442 \u043d\u0430 \u0445\u0430\u0431\u0440\u0435<\/s>, \u0434\u0430 \u0438 \u043f\u0438\u0441\u0430\u0440\u044c \u0438\u0437 \u043c\u0435\u043d\u044f \u043d\u0438\u043a\u0443\u0434\u044b\u0448\u043d\u044b\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u0447\u0442\u043e \u043d\u0435 \u0442\u0430\u043a, \u0438\u0437\u0432\u0438\u043d\u044f\u0439\u0442\u0435. <\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-210402","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/210402","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=210402"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/210402\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=210402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=210402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=210402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}