views:

43

answers:

2
<script type="text/javascript">
    $("a.route").live('click', function() { // live is better
        $("#results").load( $(this).attr('href') );
        return false;
    });
</script>  

thats the code, how can I incorporate the code you just gave me?

A: 

if you want to use a custom box you could do it like that:

test link: http://jsfiddle.net/myDry/

function blockmeornot(extlink) {
    var oherf = $(extlink).attr('href')
    var msgboxID = 'areyousure'
    var msgbox = '<div id="' + msgboxID +'"><div><p> put your message here </p><a class="yes" href="' + oherf + '"> yes </a> <a class="no" href="#"> no </a></div></div>'
    $('body').append(msgbox)
    $('#' + msgboxID + ' a.no').live('click', function(){ $('#' + msgboxID).fadeOut(400, function(){$(this).remove()}) })
}

$('a.external').click(function(){ blockmeornot(this); return false })
meo
I am happy with the jquery confirm function, I just want it to trigger the code above if user clicks OK.
vick
its just for the eye candy. do whatever you want with it :P so could you please an accept a answer?
meo
+1  A: 

The Confirm dialog returns true if the user clicks the OK button, or false if the user clicks on the Cancel button. You can use this value to trigger your script if they've clicked OK like this:

<script type="text/javascript">
    $("a.route").live('click', function() {
        if (confirm("Are you sure?")) {
            $("#results").load( $(this).attr('href') );
        }
        return false;
    });
</script>
Dexter
worked like a charm thanks!!
vick
glad to be of assistance.. don't forget to vote / accept ;-)
Dexter