JAVASCRIPT get current language!!!
l33roy - September 13, 2009 - 01:40
How can i get current language in jquery.ajax.cart.js file? Is it possible?
.module file:
drupal_add_js( drupal_get_path('module', 'uc_ajax_cart') .'/js/jquery.ajax.cart.js' );
Maybe parsing the url? I use: base_url() - default language, base_url().'/en' - English language.
Help please...

Hi "window.location" has
Hi
"window.location" has what's in the address bar of your browser.
If that doesn't work, try window.location.href. you might want to do some parsing in javascript level to get exactly what you need
also you can pass the variable from module file and use it in js file.
e.g.
$js_variables = array(
'first_var' => arg(1),
'second_var' => $url_lang,
);
drupal_add_js(array('modulename' => $js_variables), "setting");
and access it using
var js_first_var = Drupal.settings.modulename.first_var;
var js_second_var = Drupal.settings.modulename.second_var;
thanks,
Shashikant.
Thanks man I think
Thanks man
I think $js_variables is the best way.
Working now...
http://nexwave.ru
ICQ: 272732793
Skype: gr0mus1
MSN: gromus@live.ru