Hi Andrew,
When you say "I have disabled the users abilty to edit a
forum within the system role" I think you mean "I have set mod/forum:editanypost ("Edit any post") = Prevent in the Authenticated user role. Is that correct?
If so, teachers will still able to edit any post if they are assigned the Teacher role in a course
context. Teacher has mod/forum:editanypost ("Edit any post") = Allow. Since Teacher is assigned in the course context, its permissions take precedence over the corresponding permissions in Authenticated user, which is assigned in an outer context. It sounds complicated, but it is very logical it gives the result you would expect. See
how permissions are calculated.
It would be better if you explained what you are trying to do, not how you are doing it.
I can't help you with Ajax.