[eluser]gbar[/eluser]
Hi, I need to return to this discussion for some clarification.
I developed a multilingual system, based on the passage of the names of languages, in variables.
This system that I found here, is certainly much better, and it allows me to begin to familiarize yourself with ajax.
Having to adapt it to an existing system, I had to make some small change, only in the languagesetup controller.
Everything would work fine, I only have a small problem that I believe is not caused by my changes.
In practice the problem is that once I click on one of the flags, the page becomes completely empty, i see only the background color.
If I press the F5 key or I refresh the page, the page is reloaded with the new language correctly.
Place code here, if anyone can give me a tip.
Thank you.
The controller languagesetup:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Languagesetup extends CI_controller
{
public function __construct()
{
parent::__construct();
}
public function set_language($lang = 'english')
{
$ref =& get_instance();
$ref->session->set_userdata('lang', $lang);
}
}
The view:
Code:
function switchToEnglish()
{
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET', '<?php echo base_url(); ?>admin/commons/languagesetup/set_language/english', false);
xmlhttp.send();
document.body[removed] = xmlhttp.responseText;
return true;
}
function switchToItalian()
{
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET', '<?php echo base_url(); ?>admin/commons/languagesetup/set_language/italian', false);
xmlhttp.send();
document.body[removed] = xmlhttp.responseText;
return true;
}
I call the two ajax function inside an onclick event handler, inside a link with href setting to #
Also, i use jquery 1.5.1. I have implemented ajax.googleapis, but i have the same problem. Thank's