You sent us a support ticket as well as this forum post. I have responded to the support ticket and you should have a response in your email.
In short, you had two instances of the form on your page, hence you are getting two alerts showing from your JavaScript. Therefore you should use the instance_id parameter to single out the form you want your code to run for.
$(document).on('wsf-rendered', function(e, form, form_id, instance_id) {
// The form ID this script should run for
var my_form_id = 8;
// Do not run this JavaScript if this event does not belong to my form ID
if(form_id != my_form_id) { return; }
alert('c');
// refreshNotes();
});
$(document).on('wsf-rendered', function(e, form, form_id, instance_id) {
// The form ID this script should run for
var my_form_id = 8;
// Do not run this JavaScript if this event does not belong to my form ID
if(form_id != my_form_id || instance_id != my_form_id ) { return; }
alert('c');
// refreshNotes();