<?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>Kurt Jarchow&#039;s Blog &#187; ajax</title>
	<atom:link href="http://www.kurtjarchow.com/tag/ajax/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kurtjarchow.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 02 Jul 2010 14:09:30 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Add Drupal Forms using AJAX</title>
		<link>http://www.kurtjarchow.com/2009/01/28/add-drupal-forms-using-ajax-jquer/</link>
		<comments>http://www.kurtjarchow.com/2009/01/28/add-drupal-forms-using-ajax-jquer/#comments</comments>
		<pubDate>Wed, 28 Jan 2009 12:05:55 +0000</pubDate>
		<dc:creator>Kurt Jarchow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://jarchowk.wordpress.com/?p=125</guid>
		<description><![CDATA[Something very easy to do in drupal is adding form object to the content of your page without doing a page refresh.  I needed to add functionality so that an application form was displayed to a user when they clicked the Apply link.
Using JQuery we can &#8220;intercept&#8221; a client click of a link.  Add a [...]]]></description>
			<content:encoded><![CDATA[<p>Something very easy to do in drupal is adding form object to the content of your page without doing a page refresh.  I needed to add functionality so that an application form was displayed to a user when they clicked the Apply link.</p>
<p>Using JQuery we can &#8220;intercept&#8221; a client click of a link.  Add a .js file to which ever module you are editing, and add the following:</p>
<p><a id="gn55_4" class="wi" title="Drag this note to move it"></a></p>
<div class="ui"><a id="gn55_2" class="qi"></a></div>
<div class="sh">
<blockquote>
<div id="gn55_0" class="qh"> if (Drupal.jsEnabled) {  </p>
<p>  $(document).ready(function () {<br />
    $(&#8217;a.apply-link&#8217;).click(function () {</p>
<p>      var submitApplication = function(data) {<br />
        $(&#8217;div.apply-link&#8217;).html(data.html);<br />
      }</p></div>
<div class="qh">    $.ajax({<br />
      type: &#8216;POST&#8217;,<br />
      url: this.href,<br />
      dataType: &#8216;json&#8217;,<br />
      success: submitApplication,<br />
      data: &#8216;js=1&#8242;<br />
    });<br />
    return false;<br />
  });<br />
  });<br />
}</div>
</blockquote>
<div class="qh">So when a link with a class &#8220;submit-application&#8221; is clicked an ajax/json call is made to the url.  Now make sure the js is included somewhere in your module code by using drupal_add_js(). </div>
</div>
<div class="qh">Now all we have to do is make sure the page renders as json if an ajax call is made.  Add this  code just before the _page exits (but not after the exit(); !).</div>
<blockquote>
<div class="qh"> if (!empty($_POST['js'])) {<br />
    $html = drupal_get_form(&#8217;job_posting_application_form&#8217;, array($node-&gt;nid, $node-&gt;title, $node-&gt;job_posting_email));<br />
    drupal_json(array(<br />
    &#8216;html&#8217; =&gt;  $html<br />
    )<br />
    );</div>
</blockquote>
<div class="qh">Your link should be replaced with the form.</div>
<div class="qh">If you want to add a little bit of animation use the jQuery animation options.  Instead of just replacing the link, make it fade in:</div>
<blockquote>
<div class="qh">$(&#8217;div.apply-link&#8217;).hide();<br />
$(&#8217;div.apply-link&#8217;).html(data.html);<br />
$(&#8217;div.apply-link&#8217;).fadeIn();</div>
</blockquote>
<div class="qh">Credit to <a href="http://www.drupalbook.com/">John K. VanDyk&#8217;s book</a> for breaking the back of this code.</div>
]]></content:encoded>
			<wfw:commentRss>http://www.kurtjarchow.com/2009/01/28/add-drupal-forms-using-ajax-jquer/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Neat Features in the NY Times</title>
		<link>http://www.kurtjarchow.com/2008/11/08/neat-features-in-the-ny-times/</link>
		<comments>http://www.kurtjarchow.com/2008/11/08/neat-features-in-the-ny-times/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 22:41:18 +0000</pubDate>
		<dc:creator>Kurt Jarchow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[new york time]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://jarchowk.wordpress.com/?p=42</guid>
		<description><![CDATA[Had a look the New York Times site recently?  The site has some very interesting new features.

Highlighting text on the page will bring up an icon to search for information on that highlighted text.
New social networking features for content sharing and recommended features on top of the header.

I am not entirely impressed with the end-to-end [...]]]></description>
			<content:encoded><![CDATA[<p>Had a look the New York Times site recently?  The site has some very interesting new features.</p>
<ul>
<li>Highlighting text on the page will bring up an icon to search for information on that highlighted text.</li>
<li>New social networking features for content sharing and recommended features on top of the header.</li>
</ul>
<p>I am not entirely impressed with the end-to-end usability of the highlighted text feature.  Instead of a nice ajax box for the search results it opens a new window, which is annoying.  I&#8217;m really impressed though in the idea.</p>
<p>The social networking features are much different than other implementations, which I&#8217;m always excited to see.  First of all, there is no password.  You can mark certain articles as &#8220;recommended&#8221;, and I&#8217;m assuming will be broadcasted to all of my &#8220;friends&#8221;.  The type of lingo used is very family to Twitter, as in I have people who I am &#8220;Following&#8221; and people who are following me &#8220;Followers&#8221;.  RSS feeds are also built in.</p>
<p>I like to see that a newspaper is innovating on the web.  With the decline in subscriptions, they are going to need a lot more of these neat kinds of features.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kurtjarchow.com/2008/11/08/neat-features-in-the-ny-times/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
