I'm attempting to pass JavaScript variables via FancyBox, so that I can access them in the window that appears. So far, I have the following code:

var s;
var e;
var fancyboxdata = new Array();
    $( '#post_code' ).blur(function(){
        s = $( '#post_code' ).val();
function map_routes(e){
    if ((s.length !== 0) && (e.length !== 0)) {
        fancyboxdata[s] = s;
        fancyboxdata[e] = e;
    } else {

$(document).ready(function() {
        ajax: {
            type: "POST",
            data: fancyboxdata
        'hideOnContentClick': true,
        'height': 600,
        'padding': 0,
        'width': 700, 
        'type': 'iframe'
At this stage, I know the fancyboxdata array contains data, but I'm unsure about the Ajax parameter in the FancyBox function, which is supposed to pass the array variable.

In the window that appears, I have:



echo $_POST['s'];

    (function() {
I've tried: print_r($_POST), $phpVar, $_POST["phpVar"], and $_POST["phpVar"], bur nothing appears, other than empty arrays and errors in the debugger.

The error is just an explanation that the fancyboxdata array variable can't be found. And in PHP:

HTML Code:
<p>Severity: Notice</p> <p>Message: Undefined index: s</p> <p>Filename: bookings/maps.php</p> <p>Line Number: 5</p>
And just so you know, I'm building this within CodeIgniter.

Any ideas?