i’ve just installed the RJS plugin per cody’s instructiuons and read
through
tutorials. I’ve made the necessary changes to my existing code and
everything appears to be working, except that the returned javascript is
not
being evaluated…
here’s my setup:
i have a checkbox with an onclick event pointing to a javascript
function.
this javascript function does a few things then sends a request. I have
the
onSuccess callback pointing to another function who’s only purpose is to
eval(resp.responseText). but this is not happening. i added an alert(
resp.responseText) and the javascript code is there, it’s just not being
evaluated.
checkbox:
javascript:
function activate_user(cb) {
var status = (cb.checked) ? “1” : “0”
var data = “id” + cb.value + “&af=” + status
var myReq = new Ajax.Request( ‘/admin/users/activate’, { :method:
‘post’,
parameters: data, onSuccess: success_handler, …)
}
function success_handler(resp) {
alert(resp.responseText);
eval(resp.responseText);
}
rjs template:
page.visual_effect :highlight, “cb_div”, { :start_color => “#aaffaa” }
the success_handler is getting called, as the alert shows the javascript
being returned as:
new Effect.Hilight(‘cb_div’, {startcolor:#aaffaa});
but as i said, it’s not getting evaluated in the eval() call. (i’m not
seeing the effect)
anyone have any ideas?
Chris