<?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>Algirdas Varnagiris &#187; ajax</title>
	<atom:link href="http://www.varnagiris.net/tag/ajax/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.varnagiris.net</link>
	<description>The cyber-place where I live</description>
	<lastBuildDate>Thu, 18 Feb 2010 17:19:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Ajax feedback form using jQuery &amp; Boxy plugin</title>
		<link>http://www.varnagiris.net/2009/04/11/ajax-feedback-form-using-jquery-boxy-plugin/</link>
		<comments>http://www.varnagiris.net/2009/04/11/ajax-feedback-form-using-jquery-boxy-plugin/#comments</comments>
		<pubDate>Sat, 11 Apr 2009 06:50:54 +0000</pubDate>
		<dc:creator>Algirdas</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[java script]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.varnagiris.net/?p=102</guid>
		<description><![CDATA[I really enjoy jQuery and its capabilities. It is more lightweight than Prototype and it can do the same or even more. Also this library has lots of plugins and one of them is Boxy. Boxy is a flexible, Facebook-style dialog box for jQuery with support for dragging and size tweening. It differs from other [...]]]></description>
			<content:encoded><![CDATA[<p>I really enjoy <a href="http://jquery.com/">jQuery</a> and its capabilities. It is more lightweight than Prototype and it can do the same or even more. Also this library has lots of plugins and one of them is <a href="http://plugins.jquery.com/project/boxy">Boxy</a>. Boxy is a flexible, Facebook-style dialog box for <a href="http://jquery.com/">jQuery</a> with support for dragging and size tweening. It differs from other overlays I&#8217;ve seen by providing an object interface to control dialogs after they&#8217;ve been created. And for simple usage scenarios, boxy also provides a <a href="http://plugins.jquery.com/">jQuery plugin</a> for automatically hooking up links and forms, as well as an ask() helper for presenting multiple choices to the user.</p>
<p>Here&#8217;s an example, taken from feedback (contact us) form:<br />
<img class="aligncenter size-full wp-image-103" title="example" src="http://www.varnagiris.net/wp-content/uploads/2009/04/example.png" alt="example" width="362" height="333" /><span id="more-102"></span></p>
<p>Lets start coding. First of all, we need to have a link. When we click it, it will create boxy window.<br />
<code>&lt;a href="#" class="contact_us"&gt;Contact us&lt;/a&gt;</code></p>
<p>Short javascript which do everything: handle contact us link click, creates boxy window, handle form submit, post form using ajax and set the respond to boxy content.</p>
<pre><code>
$(function() {
    /* set global variable for boxy window */
    var contactBoxy = null;
    /* what to do when click on contact us link */
    $('.contact_us').click(function(){
        var boxy_content;
        boxy_content += "&lt;div style=\"width:300px; height:300px\"&gt;&lt;form id=\"feedback\"&gt;";
        boxy_content += "&lt;p&gt;Subject&lt;br /&gt;&lt;input type=\"text\" name=\"subject\" id=\"subject\" size=\"41\" /&gt;&lt;/p&gt;&lt;p&gt;Your name and/or email:&lt;br /&gt;&lt;input type=\"text\" name=\"your_email\" size=\"41\" /&gt;&lt;/p&gt;&lt;p&gt;Comment:&lt;br /&gt;&lt;textarea name=\"comment\" id=\"comment\" cols=\"39\" rows=\"5\"&gt;&lt;/textarea&gt;&lt;/p&gt;&lt;br /&gt;&lt;input type=\"submit\" name=\"submit\" value=\"Send &gt;&gt;\" /&gt;";
        boxy_content += "&lt;/form&gt;&lt;/div&gt;";
        contactBoxy = new Boxy(boxy_content, {
            title: "Send feedback",
            draggable: false,
            modal: true,
            behaviours: function(c) {
                c.find('#feedback').submit(function() {
                    Boxy.get(this).setContent("&lt;div style=\"width: 300px; height: 300px\"&gt;Sending...&lt;/div&gt;");
                    // submit form by ajax using post and send 3 values: subject, your_email, comment
                    $.post("feedback.php", { subject: c.find("input[name='subject']").val(), your_email: c.find("input[name='your_email']").val(), comment: c.find("#comment").val()},
                    function(data){
                        /*set boxy content to data from ajax call back*/
                        contactBoxy.setContent("&lt;div style=\"width: 300px; height: 300px\"&gt;"+data+"&lt;/div&gt;");
                    });
                    return false;
                });
            }
        });
        return false;
    });
});
</code></pre>
<p>So thats all. I believe you will be able to create feedback.php your self. And <a href="http://www.varnagiris.net/wp-content/examples/boxy_feedback/">here is the live demo</a> of this feedback (a.k.a contact us) form</p>
]]></content:encoded>
			<wfw:commentRss>http://www.varnagiris.net/2009/04/11/ajax-feedback-form-using-jquery-boxy-plugin/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Change content using AJAX with FadeIn FadeOut effect</title>
		<link>http://www.varnagiris.net/2009/02/26/change-content-using-ajax-with-fadein-fadeout-effect/</link>
		<comments>http://www.varnagiris.net/2009/02/26/change-content-using-ajax-with-fadein-fadeout-effect/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 16:34:38 +0000</pubDate>
		<dc:creator>Algirdas</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[effect]]></category>
		<category><![CDATA[fade]]></category>
		<category><![CDATA[java script]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.varnagiris.net/?p=60</guid>
		<description><![CDATA[Here you will find how to do such a trick: when somebody clicks the button, the old content fades out and then the new fades in. To do this I used jQuery witch is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. [...]]]></description>
			<content:encoded><![CDATA[<p>Here you will find how to do such a trick: when somebody clicks the button, the old content fades out and then the new fades in.<br />
To do this I used <a href="http://jquery.com/">jQuery</a> witch is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.<br />
<span id="more-60"></span><br />
The java script code is quite short and easy:</p>
<pre>
<code>
function refreshContent() {
  $("#content").fadeOut("slow", function(){
    $("#content").load("getrandomcontent.php",false, function() {
      $("#content").fadeIn("slow");
    });
  })
  return false;
}
</code>
</pre>
<p>Now you can use this function for a link<br />
<code>&lt;a href="#" onclick="return refreshContent();"&gt;Refresh&lt;/a&gt;</code><br />
When you click it, the content in <strong>div</strong> element with an id <em>&#8220;content&#8221;</em> will be changed. getrandomcontent.php is used to get random content.</p>
<p><a href="http://www.varnagiris.net/wp-content/examples/ajax_fade/">Check our demo</a>.</p>
<p><em>If this post helped you to solve your problem, please donate me. Donation button can be found on the right side of the page.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.varnagiris.net/2009/02/26/change-content-using-ajax-with-fadein-fadeout-effect/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
