Jump to content

Passing Variables into Modal Dialogue/Window.


tebrown

Recommended Posts

i really don't think it is the JS though. try changing the loop a few time as follows tell me what you get.

 

 

while($rows=mysql_fetch_array($result,MYSQL_NUM) { //output as numerical index
}

 

while($rows=mysql_fetch_array($result,MYSQL_ASSOC) { //output as associative index
}

 

while($rows=mysql_fetch_array($result,MYSQL_BOTH) { //output  both assoc and numerical index
}

 

 

 

Link to comment
Share on other sites

I played around with it for a while but easnt working still. I then looked into this forum post:

 

http://stackoverflow.com/questions/8585361/jquery-dialog-box-passing-variable-value-from-php-to-jquery-function

 

So i tried out the iFrame, i got it to work and it now shoes the id for each link.

 

But iFrame's seem to take away my css styling. I've lost all my style within the modal itself.

 

jQuery(function ($) {


        // Load dialog on click
        $('#basic-modal .basic').click(function (e) {
        e.preventDefault();

        // Display an external page using an iframe
        var src = $(this).attr('href');
        $.modal('<iframe src="' + src + '" height="450" width="400" style="border:0">', {

            overlayClose:true
        });

            return false; // not sure why you're doing this
        }); // end of click handler

    });  // end of document.ready

 

 

Link to comment
Share on other sites

Ok i found a solution but i'm not sure how safe in regards to coding standards.

 

jQuery(function ($) {

 

// Load dialog on click

$('.basic').click(function (e) {

var id = $(this).attr("href");

$('#showvalue').text(id)

$('#content-one').modal({

overlayClose:true,

opacity:40

 

});

return false;

 

});

 

});

 

When the user clicks a specific fixture from the list, it will open the modal and then show the id number within the div 'showvalue'.

 

To echo it out i did the following.

 

$id = '<div id="showvalue"></div>';

echo $id;

 

Tell me what you think.

 

Cheers

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.