[eluser]gwerner[/eluser]
I'm trying to implement a jQuery pop up modal that catches links that will send a user away from my site. The jQuery catches any link with a class of "depart". I'm using .get to grab the appropriate controller that will then grab the default view and load that into the modal. I think what is happening is since I'm passing URLs as a segment variable, Codeigniter is trying to use the segments created in the passed URL? Which in turn is resulting in 404 errors. Which is where I'm stuck.
Any help is appreciated. Even if there is better way to handle this all together.
Sample Link
Code:
<a class="depart" href="http://www.newsite.com/you/are/now/leaving/example.html?v=1">A link that will exit the site.</a>
The above would output to Codeigniter using the jQuery .get below:
/depart/http://www.newsite.com/you/are/now/leaving/example.html?v=1
Jquery
Code:
jQuery(function ($) {
var OSX = {
container: null,
init: function () {
$('.depart').click(function (e) {
e.preventDefault();
var myid = $(this).attr('href');
$.get("/depart/" + encodeURIComponent(myid), function(data){
$(data).modal({
opacity: 65,
overlayClose: true,
onOpen: OSX.open
});
});
});
},
open: function (d) {
var self = this;
self.container = d.container[0];
d.overlay.fadeIn('slow', function () {
$("#depart", self.container).show();
d.container.fadeIn('slow', function () {
d.data.fadeIn('slow');
});
});
}
};
OSX.init();
});