Re: Passing information across pages (please ignore previous message)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks. I have figure out how to pass it back to parent window and looked
into how JSON encode it and decode on PHP. The one thing I haven't been
able to figure out is AJAX part. I understand that I have to make an  AJAX
POST call, and I know that I can use something along the line
$.post(parent.page.php, {variable: variable}). So I created a global
function that is called from the child window and among the things it does
is the $.post.

However, I have not been able to read $_POST['variable'] from within the
php page parent.page.php. It seems to me that since the code was evaluated
after the HTTP request I am doing something wrong where the AJAX request is
not causing the code to be evaluated again an thus something like

if (isset ($_POST['variable'])) {
      $array = json_decode($_POST['variable'];
      print_r $array;
}

does not work. I have tried many forums out there, but could not solve it.
If anybody has any suggestion or even suggested reading, that would be
awesome.

Jeffy,

I have a safari account so I will look at book!

T.

On Wed, Mar 11, 2015 at 9:48 PM, Jeffry Killen <jekillen@xxxxxxxxxxx> wrote:

>
> On Mar 11, 2015, at 4:24 PM, Tiago Hori wrote:
>
>  Thanks, Jeffry.
>>
>> Super helpful. I will do some reading on it. We are a small company, so
>> the browsers won't be an issue.
>>
>> That's a good point about security. I will see what I can find.
>>
>> T.
>>
>> Sent from my iPhone
>>
>
> If you are up to an extensive and (not for complete beginners) relatively
> easy to understand text
> you will get a lot of useful information from O'Reilly's: Javascript: The
> Definitive Guide, 6th Ed, David Flanagan
> However you will have to be able to think abstractly and adapt the code
> examples they give to  illustrate
> programming concepts and applications.
>
> sorry if this looks like an inappropriate ad to this list admins.
>
> Best
> JK
>
>
>>  On Mar 11, 2015, at 7:29 PM, Jeffry Killen <jekillen@xxxxxxxxxxx> wrote:
>>>
>>>
>>>  On Mar 11, 2015, at 11:18 AM, Tiago Hori wrote:
>>>>
>>>> Folks,
>>>>
>>>> I have a PHP application that stores fairly large datasets. Each data
>>>> set
>>>> is composed of data points for 96 markers in 96 individuals. Right now,
>>>> the
>>>> user can either download the whole dataset or supply a list of markers
>>>> in a
>>>> txt file. However, the users want me to make a pop up form (I was
>>>> thinking
>>>> radio buttons) in which they can select the markers they want from the
>>>> dataset.
>>>>
>>>> So I was thinking of a scheme where I would use java script to open
>>>> another
>>>> window, where the form with the radio buttons would be populated based
>>>> on
>>>> the database. The user would select the markers he wants and I would
>>>> store
>>>> that in session array.
>>>>
>>>> Then I can use the selection in the script that actually processes the
>>>> data.
>>>>
>>>> Does that sound feasible and relatively efficient?
>>>>
>>>> T.
>>>>
>>>
>>> HI;
>>>
>>> If you are going to use javascript to open the window, the window will
>>> have a
>>> javascript based reference to the window with the script that opened it
>>> as
>>>
>>> window.opener
>>>
>>> for the most part you will have access via this reference to scripts and
>>> elements in the opening
>>> window and document objects.
>>>
>>> In the secondary window you would have some kind of javascript enabled
>>> element that would take the users selections and send it to a function in
>>> the window.opener window to process from there (instead of a form
>>> submission button)
>>>
>>> This requires a fair amount of javascript familiarity to implement.
>>> But it would take some load off the server, and if security is a
>>> concern, the users data
>>> choices won't be exposed to the network until some final submission
>>> processing is
>>> done. The user WILL need javascript enabled. And if all browser types
>>> are to be
>>> allowed for, both DOM compatible and Internet Explorer browsers must be
>>> coded for.
>>>
>>> The most significant difference between DOM browsers and Internet
>>> Explorer is
>>> the way that event listeners are assigned and removed; different syntax
>>> for each.
>>> Also the "ajax" XMLHttpRequest object syntax will be different.
>>>
>>> I hope this is useful.
>>> JK
>>>
>>>
>>>
>>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>


-- 
"Education is not to be used to promote obscurantism." - Theodonius
Dobzhansky.

"Gracias a la vida que me ha dado tanto
Me ha dado el sonido y el abecedario
Con él, las palabras que pienso y declaro
Madre, amigo, hermano
Y luz alumbrando la ruta del alma del que estoy amando

Gracias a la vida que me ha dado tanto
Me ha dado la marcha de mis pies cansados
Con ellos anduve ciudades y charcos
Playas y desiertos, montañas y llanos
Y la casa tuya, tu calle y tu patio"

Violeta Parra - Gracias a la Vida

Tiago S. F. Hori. PhD.
Ocean Science Center-Memorial University of Newfoundland

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux