Page 1 of 1

passing a large data structure for a modal dialog

Posted: Tue Jul 05, 2005 4:27 am
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

Posted: Tue Jul 05, 2005 4:40 am
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
-

Posted: Tue Jul 05, 2005 4:46 am
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