1

Hey Guys, I am new to jQuery and am not experienced with it at all...

Basically my goal is to have a modal popup with php variables passed to it...

for example - EITHER load a popup php page, view_details.php?id=1

OR

pass the php variables directly to the modal for the specified id.

I hope my question is not too confusing and is understandable, any advice would be recommended. I currently have jqueryUI installed, but am open to using any module.

Greg

3 Answers 3

3

Ok so:

$('<div>').load('something.php').dialog();

And voila you have your dialog :-)

Sign up to request clarification or add additional context in comments.

Comments

1

You might also want check out json datatype so youcould iterate over list of variables.

    $.ajax({
        url: 'request.php',
        data: {'getParam1': 'foo', 'getParam2': 'bar'},
        dataType: 'json',
            success: function(response) {
                $div = $('#myDiv'); //Id for your div
                    $.each(response, function(k, v) {
                        $div.append(v);
                    }); 
                $div.dialog();
            }
    });

request.php

<?php

    $variables = array(
        'variable1',
        'variable2',
        'variable3',
        'param1: '.$_GET['getParam1'],
        'param2: '.$_GET['getParam2']
    );

echo json_encode($variables);

?>

Comments

1
$('#modalDivID').load('view_details.php?id=1').dialog();

view_details.php

<?php
    $id=$_REQUEST['id'];
    echo 'This is popup #'.$id;
?>

2 Comments

the ?id=1 is causing problems... without the ?id=1 it works fine
@Greg if you want to use $_GET values you should use jQuery's $.get()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.