Submitted by tyler on Tue, 09/20/2011 - 11:16
Sometimes a prerequisite to getting a burrito for lunch involves using Drupal URL arguments in Javascript. So for example, say you had a URL like this:
http://www.tylerfrankenstein.com/chicken/burrito/combo
You can add code like this to your module:
function my_module_init () {
drupal_add_js(array('arg' => arg()),'setting');
}
And finally you can use code like this in Javascript to use the Drupal URL arguments:
Submitted by tyler on Wed, 05/18/2011 - 15:15
Robot: "What time is it JavaScript, buddy? And when you answer, it better be in the format of 'YYYY-MM-DD HH:MM:SS' in 24 hour format with preceeding zeros on the month, day, hour, minute and second, or else!"
Me: "Relax big guy, just call this function, friend."
Submitted by tyler on Mon, 05/16/2011 - 11:29
So today Internet Explorer again decided to be totally awesome...
I have a simple javascript regular expression that extracts the Drupal 'page' variable from a link that was clicked:
<a href="/code?page=1" id="tf_example_link">next page</a>
$('a#tf_example_link').click(function () {
var page = /[\?&]+page=([0-9]+)[\?&]?/($(this).attr('href'));
alert(page); // alert output: 1
});
This works in all browsers, except....... drum roll.............. Internet Explorer! Surprised? Probably not.
Submitted by tyler on Mon, 11/08/2010 - 21:52