[eluser]zyddee[/eluser]
Ive got this javascript code that i want to be executed from the controller whit help of Ajax.Updater..
Ive set the parameter evalScripts to true, but it still doesn't executes the javascript, iv also tried to tell the function that the content-type is text/javascript without success.. somebody who knows what I'm doing wrong here?
copy/pasted this from scriptaculous page:
Quote:Hint: If you have set evalScripts:true the script you call (the url parameter) must return a header of ‘Content-Type: text/javascript’ else the browser will not execute it.
my code:
Code:
new Ajax.Updater('timeChart', base_+'timeChart_controller/refresh_grid, {method: 'post', postBody:'weekno='+weekno, evalScripts:true, insertion:'Top'});
Code:
function refresh_grid()
{
header("Content-Type: text/javascript; charset=UTF-8");
$data = "< script >";
$data .= "alert('foo');"
$data .= "</ script >";
echo $data;
}