<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>乱世浮生 &#187; ajax</title>
	<atom:link href="http://pigsky.net/tag/ajax/feed" rel="self" type="application/rss+xml" />
	<link>http://pigsky.net</link>
	<description>Just a WordPress weblog</description>
	<lastBuildDate>Fri, 09 Dec 2011 02:34:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>主题Flashy升级到1.2.1</title>
		<link>http://pigsky.net/wp-theme-flashy-upgrade-to-1-2-1</link>
		<comments>http://pigsky.net/wp-theme-flashy-upgrade-to-1-2-1#comments</comments>
		<pubDate>Sat, 30 Jan 2010 04:34:40 +0000</pubDate>
		<dc:creator>忘记月亮</dc:creator>
				<category><![CDATA[WordPress主题]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://pigsky.net/wp-theme-flashy-upgrade-to-1-2-1</guid>
		<description><![CDATA[Flashy更新到了1.2.1，到了1.2之后加上了Ajax评论的功能。可能有些人对此不感冒，但我还是比较喜欢的。 Ajax评论蓄谋已久，但由于自己水平能力的限制一直都未实现。由于多php、jQuery、Ajax开发的欠缺和对WordPress的理解不深刻，两次的提交都未成功。主要的问题就是Ajax请求的处理方式的问题。 现在用的方法是不改变评论的路径，依然是提交到wp-comments-post.php。在转向的时候做处理，在functions.php中添加如下代码： add_filter('comment_post_redirect','commentAjaxPost',10,2) 在“commentAjaxPost”方法中对$comment进行处理。主要就是将comment.php中的&#60;li&#62;标签连同其内部的代码拷贝到“commentAjaxPost”方法中，并在方法末尾使用”exit;”。剩下的工作就是在js中处理响应内容了。 这种方法也比较简单，唯一不足的地方时wp-comments-post.php中的异常处理用的是wp_die()，这个方法会生成一个包含错误信息的页面。在Ajax中，我们就要从改页面的代码中找出我们所要显示给用户的错误信息。 另外在网上查到了位于wp-admin/admin-ajax.php中的wp_ajax_{$_GET[action]}和wp_ajax_{$_POST[action]}两个hook，不知道是不是可以用在处理Ajax请求中。有待研究… 下载 flashy 1.2.1]]></description>
			<content:encoded><![CDATA[<p>Flashy更新到了1.2.1，到了1.2之后加上了Ajax评论的功能。可能有些人对此不感冒，但我还是比较喜欢的。</p>
<p>Ajax评论蓄谋已久，但由于自己水平能力的限制一直都未实现。由于多php、jQuery、Ajax开发的欠缺和对WordPress的理解不深刻，两次的提交都未成功。主要的问题就是Ajax请求的处理方式的问题。</p>
<p>现在用的方法是不改变评论的路径，依然是提交到wp-comments-post.php。在转向的时候做处理，在functions.php中添加如下代码：</p>
<blockquote style="margin-right: 0px" dir="ltr"><p>add_filter('comment_post_redirect','commentAjaxPost',10,2)</p>
</blockquote>
<p dir="ltr">在“commentAjaxPost”方法中对$comment进行处理。主要就是将comment.php中的&lt;li&gt;标签连同其内部的代码拷贝到“commentAjaxPost”方法中，并在方法末尾使用”exit;”。剩下的工作就是在js中处理响应内容了。</p>
<p dir="ltr">这种方法也比较简单，唯一不足的地方时wp-comments-post.php中的异常处理用的是wp_die()，这个方法会生成一个包含错误信息的页面。在Ajax中，我们就要从改页面的代码中找出我们所要显示给用户的错误信息。</p>
<p>另外在网上查到了位于wp-admin/admin-ajax.php中的wp_ajax_{$_GET[action]}和wp_ajax_{$_POST[action]}两个hook，不知道是不是可以用在处理Ajax请求中。有待研究…</p>
<p><a href="http://wordpress.org/extend/themes/flashy" target="_blank">下载 flashy 1.2.1</a></p>
]]></content:encoded>
			<wfw:commentRss>http://pigsky.net/wp-theme-flashy-upgrade-to-1-2-1/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

