How to load jQuery and Bootstrap within iMacro

2019-08-21 10:54发布

问题:

I was able to load jQuery successfully within an iMacros however I couldn't load bootstrap.js. iMacros tells me that the function .modal doesn't exist.

loadScriptFromURL('http://localhost.com:7001/ybswcsstub/resources/plugins/jquery-1.10.2.min.js');

$ = window.$, JQuery = window.JQuery;

$.getScript('http://localhost.com:7001/ybswcsstub/resources/plugins/bootstrap/js/bootstrap.js');

$('body').append('<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">' +
'  <div class="modal-dialog">'+
'    <div class="modal-content">'+
'      <div class="modal-header">'+
'        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>'+
'        <h4 class="modal-title" id="myModalLabel">Modal title</h4>'+
'      </div>'+
'      <div class="modal-body">'+
'        Some Modal'+
'      </div>'+
'      <div class="modal-footer">'+
'        <button type="button" class="btn btn-default"     data-dismiss="modal">Close</button>'+
'        <button type="button" class="btn btn-primary">Save changes</button>'+
'      </div>'+
'    </div>'+
'  </div>'+
'</div>');

$('#myModal').modal('show');

When I run I get the following error in iMacros TypeError: $(...).modal is not a function, line 211 (Error code: -991)

Any help would be greatly appreciated as I'm kind of stuck at this point :s

Edit:I had to use $.getScript to load the bootstrap.js (the .com in the domain is because of stackoverflowrestriction) as when I tried to use the loadScriptFromURL, I was getting the error

Error: Bootstrap's JavaScript requires jQuery, line 7 (Error code: -991)

Thanks, Mark.