It appears you are trying to add session data using Ajax and that is failing. That would make this an Ajax or JavaScript issue..
You might be better off trying a JavaScript support forum. Personally, I try to use frameworks such as Codeigniter to avoid JavaScript whenever possible.