Skip to main content
Monthly Archives

June 2014

Comet: A jQuery and PHP Implementation

By Comet, Javascript, John Wenzler, jQuery, PHP, Web Design

If you’ve ever needed real-time data on the front-end of your website and you were using PHP as your back-end, you are most likely familiar with using a polling technique to fetch data.  What you may not know, however, is that another method exists for pulling data that does not require a large number of unnecessary requests.  Enter Comet…   Sounds great right? Just wait for the data to come to you! The problem? Currently, no built in Comet functionality exists for PHP and Javascript.  I’ll share with you my code for implementing a Comet controller. In this article I’ll provide the functions you need to get this working today on your project.  You will have to make some modifications to fit the framework and structure of your site, but if you need help, just leave a comment and I’ll do my best to get back to you! The PHP How to make a long held http request Before we delve into code, I’ll give you a short summary of how we are going to accomplish our goals.  We will utilize a file on our system to keep track of if there are any changes we need to “push” to the…

Read More

Top 5: jQuery Functions You May Not Have Known

By Coding, Javascript, John Wenzler, jQuery, Web Design
Welcome to my first of a series of website coding language related top five lists. I'm going to start us off with some functions from jQuery that you may or may not know. There is no particular order to this list, just a set of what I consider interesting and potentially useful functions in jQuery.  Let's get started! trim() What it does Trim is a super simple function that removes any leading or trailing whitespace from a string How to use it var myString = " Trim is great "; var trimmedString = myString.trim(); //myString is now "Trim is great" » Read More: jQuery docs In Action Enter string here Trimmed version generated here: "" fadeToggle() What it does Toggles the visibility of an element with a fading effect. The function also accepts parameters for duration of the fading effect, the easing function to be used furing fading, as well as a callback function for when the effect is complete. You may want to use this function because it takes care of issues with trying to fade in or out while the opposite effect is still not complete. How to use it var element = $("#someElement"); var button = $("#fadeToggleButton"); button.click(function(){...
Read More