Posts Tagged ‘JQuery’

Using JavaScript/jQuery to match a word in the URL string and apply CSS accordingly

October 16th, 2012

Styling based on window

A little back story into why I am writing this little post:

I am currently working on a web app that requires different functionality and styling between desktop and mobile views (Yes, I’m talking responsive here :D ). I ran into some trouble with the “mobile menu” view – the menu gets hidden for mobile to make space for content (UX win!) which the user can then call back into view via a button that is only visible in mobile. Pretty standard stuff right?
» Read more: Using JavaScript/jQuery to match a word in the URL string and apply CSS accordingly

Pulling data from Twitter with jQuery

October 21st, 2011

Twitter have made data retrieval pretty damn simple.. I managed to lookup all the info I needed and write this code in just a few minutes.. My requirements were quite simple though, all I had to do was retrieve the top 2 latest tweets from a specific user and display them on a page.

All the documentation you need can be found here: https://dev.twitter.com/docs. To fulfill this requirement I needed to use the following api url: https://api.twitter.com/1/statuses/user_timeline.json. This allows me to retrieve tweets from a user.

Let’s get started..

» Read more: Pulling data from Twitter with jQuery

IE Error when retrieving XML using JQuery .ajax()

June 22nd, 2011

Had an irritating error in IE 9 (and under) when trying to retrieve some XML using jQuery’s $.ajax() function, part of the issue ended up being that the dataType parameter MUST be in capital letters, for example:

This does not work:

$(document).ready(function()
{
  jQuery.ajax({

    type: "GET",
    url: "localXMLFile.xml",
    dataType: "xml",
    success: function( status )
    {
      //Success
    },
    complete: function( status )
    {
      //Complete
    },
    error: function( status )
    {
      //Error
    }
  });
});

» Read more: IE Error when retrieving XML using JQuery .ajax()