1

I'm trying to make a remote modal(bootstrap4) in my webpage, I use the below URL and it works with only the remote file's modal-content, while its javascript didn't work.

Bootstrap 4 with remote Modal

Can someone tell me how to let the javascript of modal HTML into the target page which shows the modal in remote?

The target HTML code: https://codepen.io/gorilla0823/pen/qLXQaM

The remote modal: https://codepen.io/gorilla0823/pen/VqzVpR

I have no idea why it works differently from my origin one. (My original one is the modal with full function, I want to let the modal remote to the target page .)

The Modal(With my translation function, and this is what I desire to display in my target page with a link): http://sehomework.000webhostapp.com/translation/index(origin).html

The modal's function: The first option is before translation, while the second option is after translation, You can select the language then translating or recognizing the letter you type, this is the full modal I'd like to display. However, it works with the content body now, it'll show the error message(speech SDK haven't found ) if the code doesn't fully work.

I want to let the modal remote to the page with a link, the content of its body works, while the script doesn't work, I've commented the code with which works and which doesn't work, the link is https://codepen.io/gorilla0823/pen/VqzVpR ( the same as the remote modal )

<!-- target.html -->
<div class="modal fade" id="theModal" tabindex="-1" role="dialog" aria- 
labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
I put my modal-content here.But the script doesn't work
</div>
</div>
</div>

<script type="text/javascript">
$('#theModal').on('show.bs.modal', function (e) {
var button = $(e.relatedTarget);
var modal = $(this);
modal.find('.modal-content').load(button.data("remote"));
});
</script>

<!-- remote modal -->
<div class="modal-header">
<script>    
//It doesn't work   
</script>
</div>
<!-- Modal body -->
<div class="modal-body">            
<div id="warning">
</div>
<script src="microsoft.cognitiveservices.speech.sdk.bundle.js"></script>
script>
//It doesn't work
</script>
</div>
<!-- Modal footer -->
<div class="modal-footer">
</div>

0 Answers0