I have a controller action like this:
def get_build_output
@project = Project.find(params[:project_id])
@build_num = params[:build_num]
has_more = true
while has_more == true
response = jenkins_client.job.get_console_output(@project.name, @build_num, 0, "html")
@output = response["output"]
has_more = response["more"]
respond_to do |format|
format.js
end
end
end
And I have a get_build_output.js.erb
file with:
$("#build_output").append("<%= raw escape_javascript(@output) %>");
What I'm trying to is continuously get output from a remote call and render it into the view, until has_more is false. Currently, the setup above only renders once and no more.
How can I re-render the page multiple times from the controller? And is there a better way to do what I'm trying to accomplish?