passing a large data structure for a modal dialog

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jasongr
Forum Contributor
Posts: 206
Joined: Tue Jul 27, 2004 6:19 am

passing a large data structure for a modal dialog

Post by jasongr »

Hello

I have a very large data structure in JavaScript that I need to pass to a modal dialog which I open with showModalDialog (and yes, I know this is IE only)

Up until now, I serialized the data structure and passed it as part of the URL

But now the data structure is too large
I thought about passing it using the vArguments parameter of the showModalDialog function, but that leads to a problem

I am using PHP to process to request for the page. When I was passing the data structure as part of the URL, I had access to that information in PHP

When I pass it via vArguments, I don't have access for it in PHP

Is there a way to solve it? as I must have PHP refer to the passed data structure and I don't want to be limited in the size of the data I send

regards
djot
Forum Contributor
Posts: 313
Joined: Wed Jan 14, 2004 10:21 am
Location: planet earth
Contact:

Post by djot »

Just write the data into a variable with PHP
-
Hi,

Assuming, you have a variable called $data_structure inside PHP that is holding your data structure, you may just write it to your websites Javascript section like this:

Code: Select all

$data_structure = "foo bar";

echo "
<script type=\"text/javascript\">
<!--
function Datastore()
{
var data = '".$data_structure."';
}
//-->
</script>
";
djot
-
jasongr
Forum Contributor
Posts: 206
Joined: Tue Jul 27, 2004 6:19 am

Post by jasongr »

Maybe the question wasn't clear enough

When I ask the question, I am in context of the client side (i.e running JavaScript code)
I need a JavaScript solution, not a PHP one

In the past I had a code like this:
window.showModalDialog(url, name, winParams);
where url encoded in it the data structure to pass to the modal window

This data structure is now too long
I need someway to invoke the modal dialog, pass the information and not be limited in its length

The trick is (and this is why I posted the question in PHP forum), is that the solution must take into account the fact that the passed data structure needs to be accessible to PHP
I hope someone with a PHP knowledge already ran into this problem and will know how to solve it

I hope this clears it
Post Reply