Home » Archive

Articles in the AJAX Category

AJAX, jQuery »

[2 Jun 2011 | One Comment | 2,298 views]

Here’s my simple jQuery image rollover script. I modified it to work with absolute URLs. This works well if you have different servers hosting your image files.

See entire post for the code ;)

jQuery »

[16 May 2011 | No Comment | 815 views]

There is a known issue with the DivX plugin causing Javascript errors ”tagName is empty or not an object”. This is due to the plugin interfering with existing Javascript on the page. Javascript elements that doesn’t use the tagName element will cause the browser to throw an error that stops any Javascript from running on the page. 

The only real fix is to uninstall the DivX plugin.

References:
http://labs.divx.com/node/16824

AJAX, jQuery, Script Reviews »

[28 Apr 2011 | No Comment | 2,590 views]

I recently found a useful jQuery plugin for adding unobtrusive web browser messages for webapps called jGrowl.

It displays a floating div with your custom message for 5-10 seconds on the top of the screen and fades out. There are options to change the duration of the message, set the message as a sticky until it is closed by the user, position options, and animation options. It is useful for showing quick informational messages such as “Saving changes”, “Update”, and “Delete”. Two unique features with this plugin are the “sticky feature” and the ability to stack consecutive messages together.

I’ve created a quick tutorial on adding this jQuery plugin to your app.

AJAX, PHP »

[23 Feb 2011 | One Comment | 4,937 views]

If you have an AJAX application that uses a PHP back-end app on a different server as your web front-end server (e.g. load balancing, cdn’s, etc), your PHP script will need to send header variables with the allowed content server name(s).

Web browsers are now following a standard for HTTP Access control to prevent client-side Cross Site scripting attacks.

I tested this with Firefox and it simply blocks the request without any error messages. Google Chrome browser will error out with the following message if the access control origin is not set correctly on your PHP script. (woot!)

“XMLHttpRequest cannot load [PHP URL].. Origin [JAVASCRIPT URL] is not allowed by Access-Control-Allow-Origin.”

For example, if the Javascript is hosted on example.com and your PHP app is on example.org.

Below is the PHP script for fixing this error. [see full message for the solution]

AJAX »

[9 Jun 2010 | One Comment | 2,673 views]

Setting a focus on an input box is a hassle with so many different browsers out there. Each browser has their own unique tag to set the focus. Rather than using the browser-specific tags for the focus, one can utilize Javascript to provide the functionality for multiple browsers.

jQuery is a great alternative to adding the focus since its simply a matter of adding a few lines of code to your page. It will work on multiple browsers, whether it be Internet Explorer, Firefox, Chrome, or Safari.

AJAX »

[22 Sep 2009 | 7 Comments | 10,364 views]

When coding your pages with Javascript/AJAX/CSS, one thing to look out for is the compatibility with your organization’s remote access device. One of the devices I have to consider is the Cisco WebVPN product. It has compatibility issues with things such as the @charset “UTF-8″; and @import command in CSS files. By default jQuery doesn’t work with WebVPN. In this post, I have a fix for making jQuery work with WebVPN.

AJAX »

[10 Feb 2009 | One Comment | 1,153 views]

The cache in Internet Explorer is not very AJAX friendly for GET/POST commands. You must put in a constantly changing variable in the URL such as date with seconds in Internet Explorer. I noticed this when the refresh of my GET command would only work once in my window.setInterval(.. , .. ) function.  However, in Mozilla and Safari, my function was working perfect.

The solution to this is to append the current date and time into the URL of your GET/POST request. Special thanks to this post.

...

var requeststring = "http://........."+"&requesttime=" + new Date().getTime();
myHttpObject.open("GET",requeststring,true);

...

 

I previously tried setting the cache to expire on the PHP header …

AJAX »

[8 Feb 2009 | One Comment | 2,098 views]

Over the weekend, I ran across a dropdown script called jdMenu that runs off the jQuery library. It turned out to work great for me, as long as the level of menus is maxed at 2. I prefer using scripts that use the jQuery library in order to simplify the maintenance of scripts and to speed up development of Ajax scripts.

From my experience, modern dropdown menus should only use <ul><li> hierarchy tags to make it easy to maintain. As long as the coder knows HTML, they should be able to modify the dropdown menu. I’ve used dropdown menu …