0

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.

fightstarr20
  • 11,682
  • 40
  • 154
  • 278
Mark Gargan
  • 831
  • 1
  • 9
  • 21
  • I want to know this too. :) – edinvnode Dec 08 '14 at 21:00
  • I resolved this problem by means of the script that doesn't load 'jquery' and 'bootstrap' with ajax but simply includes them into DOM of the web-page from iMacros. I think such way is more appropriate for similar tasks. However note that handling of '$' will be slightly different in such case. – Shugar Dec 12 '14 at 18:00

0 Answers0