On a form, I have a <select> which is bound to a javascript function when it changes:
$("#ctl_select").change(lts.updateDocumentFields);
In a controller, I have an unrelated web method that needs trigger this same function call when it's done. So, I thought I'd do this:
def my_web_method
...
...
js="lts.updateDocumentFields();"
hobo_ajax_response( :postamble => js )
end
While this actually works and does the job, it leaves an "ajax failed" message in the Chrome console.
Instead, I find I've had to do the following to avoid the "ajax failed" message, but it feels more like a hack:
# Trigger the change event manually to get updateDocumentFields to fire:
js="$('#ctl_select_nature').change();"
hobo_ajax_response( :postamble => js )
Anyone have an idea what the origin of the "ajax failed" message would be when I make a direct call to that javascript function instead of via the bound event?
Any insight would be great.
Thanks!
Tim