Jesse Orange Jesse Orange - 1 year ago 84
jQuery Question

Bootstrap modal and using external URLs

I am working on a modal popup in which users can fill in a form or skip the form and continue to an external URL.

enter image description here

This is the code that opens the modal:

<a class="btn btn-info btn-lg open-AddBookDialog" data-toggle="modal" data-target="#myModal" data-remote="http//">Open Modal</a>

$(document).on("click", ".open-AddBookDialog", function () {
var partner_url = $(this).data('remote');
$('#skip').attr('href', partner_url);

The code here is attached to the button that opens the modal, this script pulls a URL from
and sets it as the href of a button in my modal.

This URL is then given to the button you can see to the right (just take me... ).

In this example I've used:
but within the modal it acts strangely and I end up with;//
despite using an absolute path.

I am also using the same URL for after the form is submitted.

My question is, why in this set up is the modal not respecting the fact that the link used is an absolute link to an external URL?

Answer Source

Are you sure you're typing your URL correctly?

You wrote http// which is an invalid URL. It should start with http://

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download