<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Комментарии на: Zend Framework и AJAX, часть 2 &#8211; AjaxContext</title>
	<atom:link href="http://zend-framework.ru/zend-framework-i-ajax-chast-2-ajaxcontext/feed/" rel="self" type="application/rss+xml" />
	<link>http://zend-framework.ru/zend-framework-i-ajax-chast-2-ajaxcontext/</link>
	<description>Статьи, руководства и заметки о фреймворке для PHP - Zend Framework</description>
	<lastBuildDate>Tue, 31 Jan 2012 11:29:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>От: 123</title>
		<link>http://zend-framework.ru/zend-framework-i-ajax-chast-2-ajaxcontext/comment-page-1/#comment-1088</link>
		<dc:creator>123</dc:creator>
		<pubDate>Tue, 23 Aug 2011 15:42:54 +0000</pubDate>
		<guid isPermaLink="false">http://zend-framework.ru/2008/05/zend-framework-i-ajax-chast-2-ajaxcontext/#comment-1088</guid>
		<description>$this-&gt;_helper-&gt;AjaxContext()-&gt;addActionContext(&#039;login&#039;, &#039;json&#039;)-&gt;initContext(&#039;json&#039;);
а вид кто будет оключать?

AjaxContext():

    Выключает макеты, если они включены.

    Устанавливает альтернативный суффикс вида, это позволяет эффективно разделять скрипты видов для различных контекстов.

    Отправляет HTTP-заголовки ответа, требуемые в данном контексте.

    Опционально вызывает предопределенные функции обратного вызова для установки контекста и/или пост-обработки.</description>
		<content:encoded><![CDATA[<p>$this-&gt;_helper-&gt;AjaxContext()-&gt;addActionContext(&#8216;login&#8217;, &#8216;json&#8217;)-&gt;initContext(&#8216;json&#8217;);<br />
а вид кто будет оключать?</p>
<p>AjaxContext():</p>
<p>    Выключает макеты, если они включены.</p>
<p>    Устанавливает альтернативный суффикс вида, это позволяет эффективно разделять скрипты видов для различных контекстов.</p>
<p>    Отправляет HTTP-заголовки ответа, требуемые в данном контексте.</p>
<p>    Опционально вызывает предопределенные функции обратного вызова для установки контекста и/или пост-обработки.</p>
]]></content:encoded>
	</item>
	<item>
		<title>От: Bob</title>
		<link>http://zend-framework.ru/zend-framework-i-ajax-chast-2-ajaxcontext/comment-page-1/#comment-1085</link>
		<dc:creator>Bob</dc:creator>
		<pubDate>Mon, 15 Aug 2011 11:14:12 +0000</pubDate>
		<guid isPermaLink="false">http://zend-framework.ru/2008/05/zend-framework-i-ajax-chast-2-ajaxcontext/#comment-1085</guid>
		<description>dataType: &quot;json&quot; - не работает,(переда)
dataType: &quot;html&quot; - работает!
хотел бы научится передавать &quot;json&quot;
где здесь собака зарыта ?</description>
		<content:encoded><![CDATA[<p>dataType: &#8220;json&#8221; &#8211; не работает,(переда)<br />
dataType: &#8220;html&#8221; &#8211; работает!<br />
хотел бы научится передавать &#8220;json&#8221;<br />
где здесь собака зарыта ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>От: cmygeHm</title>
		<link>http://zend-framework.ru/zend-framework-i-ajax-chast-2-ajaxcontext/comment-page-1/#comment-1084</link>
		<dc:creator>cmygeHm</dc:creator>
		<pubDate>Fri, 12 Aug 2011 11:55:07 +0000</pubDate>
		<guid isPermaLink="false">http://zend-framework.ru/2008/05/zend-framework-i-ajax-chast-2-ajaxcontext/#comment-1084</guid>
		<description>Боб! добавь data:


dataType: “json”, 
data: { &#039;login&#039;: login, &#039;password&#039;: password }</description>
		<content:encoded><![CDATA[<p>Боб! добавь data:</p>
<p>dataType: “json”,<br />
data: { &#8216;login&#8217;: login, &#8216;password&#8217;: password }</p>
]]></content:encoded>
	</item>
	<item>
		<title>От: Bob</title>
		<link>http://zend-framework.ru/zend-framework-i-ajax-chast-2-ajaxcontext/comment-page-1/#comment-1083</link>
		<dc:creator>Bob</dc:creator>
		<pubDate>Wed, 10 Aug 2011 13:27:51 +0000</pubDate>
		<guid isPermaLink="false">http://zend-framework.ru/2008/05/zend-framework-i-ajax-chast-2-ajaxcontext/#comment-1083</guid>
		<description>Здравствуйте!
Интересная статья, попробовал сделать, но не получается...

основная проблемма 
---------------------------
$this-&gt;getRequest()-&gt;isXmlHttpRequest() - ничего не возвращает
---------------------------

кусочек моего вида (пробовал по всякому)
..........

function submitform(login, password) 
{       
//посылаем наш аякс-запрос
$.ajax({
url:&#039;http://полный путь к скрипту (назвал его login2)&#039;,
type: &#039;POST&#039;,
dataType: &quot;json&quot;,
{ login: login, password: password },
success: function(response){
alert(&#039;Данные отправлены! Сервер вернул ответ: &#039; + response);
}
error: function(response){ alert(&#039;Данные отправлены! Сервер вернул ответ: &#039; + response);}
complete:  function(response){ alert(&#039;Данные отправлены! Сервер вернул ответ: &#039; + response);}
});
}

................
тут без изменений

помогите выяснить плиз, почему $this-&gt;getRequest()-&gt;isXmlHttpRequest() - ничего не возвращает

спасибо, надеюсь решение поможет и другим, кто столкнулся с такой проблеммой</description>
		<content:encoded><![CDATA[<p>Здравствуйте!<br />
Интересная статья, попробовал сделать, но не получается&#8230;</p>
<p>основная проблемма<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
$this-&gt;getRequest()-&gt;isXmlHttpRequest() &#8211; ничего не возвращает<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>кусочек моего вида (пробовал по всякому)<br />
&#8230;&#8230;&#8230;.</p>
<p>function submitform(login, password)<br />
{<br />
//посылаем наш аякс-запрос<br />
$.ajax({<br />
url:&#8217;http://полный путь к скрипту (назвал его login2)&#8217;,<br />
type: &#8216;POST&#8217;,<br />
dataType: &#8220;json&#8221;,<br />
{ login: login, password: password },<br />
success: function(response){<br />
alert(&#8216;Данные отправлены! Сервер вернул ответ: &#8216; + response);<br />
}<br />
error: function(response){ alert(&#8216;Данные отправлены! Сервер вернул ответ: &#8216; + response);}<br />
complete:  function(response){ alert(&#8216;Данные отправлены! Сервер вернул ответ: &#8216; + response);}<br />
});<br />
}</p>
<p>&#8230;&#8230;&#8230;&#8230;&#8230;.<br />
тут без изменений</p>
<p>помогите выяснить плиз, почему $this-&gt;getRequest()-&gt;isXmlHttpRequest() &#8211; ничего не возвращает</p>
<p>спасибо, надеюсь решение поможет и другим, кто столкнулся с такой проблеммой</p>
]]></content:encoded>
	</item>
	<item>
		<title>От: cmygeHm</title>
		<link>http://zend-framework.ru/zend-framework-i-ajax-chast-2-ajaxcontext/comment-page-1/#comment-945</link>
		<dc:creator>cmygeHm</dc:creator>
		<pubDate>Thu, 21 Oct 2010 10:23:31 +0000</pubDate>
		<guid isPermaLink="false">http://zend-framework.ru/2008/05/zend-framework-i-ajax-chast-2-ajaxcontext/#comment-945</guid>
		<description>Если имя Action&#039;а содержит два слова и второе начинается с большой буквы, то у меня вылетает ошибка что такой экшен не существует.
Как быть?

Например для экшена с именем generateReportAction.</description>
		<content:encoded><![CDATA[<p>Если имя Action&#8217;а содержит два слова и второе начинается с большой буквы, то у меня вылетает ошибка что такой экшен не существует.<br />
Как быть?</p>
<p>Например для экшена с именем generateReportAction.</p>
]]></content:encoded>
	</item>
	<item>
		<title>От: oleg</title>
		<link>http://zend-framework.ru/zend-framework-i-ajax-chast-2-ajaxcontext/comment-page-1/#comment-919</link>
		<dc:creator>oleg</dc:creator>
		<pubDate>Fri, 10 Sep 2010 15:02:40 +0000</pubDate>
		<guid isPermaLink="false">http://zend-framework.ru/2008/05/zend-framework-i-ajax-chast-2-ajaxcontext/#comment-919</guid>
		<description>Спасибо, помогло :)</description>
		<content:encoded><![CDATA[<p>Спасибо, помогло <img src='http://zend-framework.ru/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>От: Oleg</title>
		<link>http://zend-framework.ru/zend-framework-i-ajax-chast-2-ajaxcontext/comment-page-1/#comment-833</link>
		<dc:creator>Oleg</dc:creator>
		<pubDate>Sat, 19 Jun 2010 18:48:55 +0000</pubDate>
		<guid isPermaLink="false">http://zend-framework.ru/2008/05/zend-framework-i-ajax-chast-2-ajaxcontext/#comment-833</guid>
		<description>Спасибо за мануал. Только вопрос. Для какой версии ZF это писалось?</description>
		<content:encoded><![CDATA[<p>Спасибо за мануал. Только вопрос. Для какой версии ZF это писалось?</p>
]]></content:encoded>
	</item>
	<item>
		<title>От: Jully</title>
		<link>http://zend-framework.ru/zend-framework-i-ajax-chast-2-ajaxcontext/comment-page-1/#comment-696</link>
		<dc:creator>Jully</dc:creator>
		<pubDate>Fri, 18 Dec 2009 21:14:15 +0000</pubDate>
		<guid isPermaLink="false">http://zend-framework.ru/2008/05/zend-framework-i-ajax-chast-2-ajaxcontext/#comment-696</guid>
		<description>конструкция такого вида 
$(&quot;#nameCheck&quot;).load(&#039;/checkname&#039;, { name: name, type: type });
так же дает прежний результат.

такое ощущение, что по каким-то соображениям до обработки view дело не доходит.

а вижу я структур вида:

{&quot;project&quot;:&quot;__NONE__&quot;,&quot;controller&quot;:&quot;checkname&quot;,&quot;area&quot;:&quot;checkname&quot;,&quot;action&quot;:&quot;index&quot;,&quot;result&quot;:false}</description>
		<content:encoded><![CDATA[<p>конструкция такого вида<br />
$(&#8220;#nameCheck&#8221;).load(&#8216;/checkname&#8217;, { name: name, type: type });<br />
так же дает прежний результат.</p>
<p>такое ощущение, что по каким-то соображениям до обработки view дело не доходит.</p>
<p>а вижу я структур вида:</p>
<p>{&#8220;project&#8221;:&#8221;__NONE__&#8221;,&#8221;controller&#8221;:&#8221;checkname&#8221;,&#8221;area&#8221;:&#8221;checkname&#8221;,&#8221;action&#8221;:&#8221;index&#8221;,&#8221;result&#8221;:false}</p>
]]></content:encoded>
	</item>
	<item>
		<title>От: Jully</title>
		<link>http://zend-framework.ru/zend-framework-i-ajax-chast-2-ajaxcontext/comment-page-1/#comment-695</link>
		<dc:creator>Jully</dc:creator>
		<pubDate>Fri, 18 Dec 2009 20:53:12 +0000</pubDate>
		<guid isPermaLink="false">http://zend-framework.ru/2008/05/zend-framework-i-ajax-chast-2-ajaxcontext/#comment-695</guid>
		<description>class ChecknameController extends Basic_Controller{
public function preDispatch(){
		parent::preDispatch();
		$this-&gt;_helper-&gt;layout()-&gt;disableLayout();
		$this-&gt;_helper-&gt;AjaxContext()-&gt;addActionContext(&#039;index&#039;, &#039;json&#039;)-&gt;initContext(&#039;json&#039;);
}

public function indexAction(){

......
$this-&gt;view-&gt;result = SOME_VAL;
}

где-то на странице вызываем такую js-ф-ию:

function checkName(name, type){
	$.get(
            &#039;/checkname&#039;,
            { name: name, type: type },
            function(data) {
                var targetDiv = document.getElementById(&quot;nameCheck&quot;);		
		targetDiv.innerHTML = data;
            }
        );</description>
		<content:encoded><![CDATA[<p>class ChecknameController extends Basic_Controller{<br />
public function preDispatch(){<br />
		parent::preDispatch();<br />
		$this-&gt;_helper-&gt;layout()-&gt;disableLayout();<br />
		$this-&gt;_helper-&gt;AjaxContext()-&gt;addActionContext(&#8216;index&#8217;, &#8216;json&#8217;)-&gt;initContext(&#8216;json&#8217;);<br />
}</p>
<p>public function indexAction(){</p>
<p>&#8230;&#8230;<br />
$this-&gt;view-&gt;result = SOME_VAL;<br />
}</p>
<p>где-то на странице вызываем такую js-ф-ию:</p>
<p>function checkName(name, type){<br />
	$.get(<br />
            &#8216;/checkname&#8217;,<br />
            { name: name, type: type },<br />
            function(data) {<br />
                var targetDiv = document.getElementById(&#8220;nameCheck&#8221;);<br />
		targetDiv.innerHTML = data;<br />
            }<br />
        );</p>
]]></content:encoded>
	</item>
	<item>
		<title>От: Jully</title>
		<link>http://zend-framework.ru/zend-framework-i-ajax-chast-2-ajaxcontext/comment-page-1/#comment-694</link>
		<dc:creator>Jully</dc:creator>
		<pubDate>Fri, 18 Dec 2009 20:28:49 +0000</pubDate>
		<guid isPermaLink="false">http://zend-framework.ru/2008/05/zend-framework-i-ajax-chast-2-ajaxcontext/#comment-694</guid>
		<description>Все замечательно, только вот отрабатывает у меня как-то неправильно:
вместо готового html-куска, посылается объект(структура) с данными запрашиваемого экшена.

Если этот экшен вызываю напрямую (из строки браузера) - то он конечно же отрабатывает и отображается в соотвествии с заданным шаблоном.... :(</description>
		<content:encoded><![CDATA[<p>Все замечательно, только вот отрабатывает у меня как-то неправильно:<br />
вместо готового html-куска, посылается объект(структура) с данными запрашиваемого экшена.</p>
<p>Если этот экшен вызываю напрямую (из строки браузера) &#8211; то он конечно же отрабатывает и отображается в соотвествии с заданным шаблоном&#8230;. <img src='http://zend-framework.ru/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

