0

Hi all,

I'm new to this forum and have searched the web for days now trying to find a solution to my problem:
function 1 builds the top of the page where the total ordered items are displayed.
For example: total 10 items.
function 2 (uses javascript's onchange=this.form.submit) builds the middle of the page where, per product, the ordered items are being displayed.
For example: some-kind-of-shoe 5 items, some-kind-of-hat 5 items (total 10 items).

But when the user changes some-kind-of-shoe 5 items into some-kind-of-shoe 1 item, i want function 1 to be triggered and update the total 10 items into total 6 items.

I've tried calling function 1 after the re-calculation in function 2 but the problem in PHP is that total 10 items changes into total 6 items but displays this underneath the middle of the page instead of updating the top of the page.
Is there a way i can trigger function 1 and update only the top part of the page?

Hopefully my explanation is a little clear.... :-)

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by Fbody
0

It sounds like you are simply calling the function and having it output to the browser which is not sufficient.

You need to use the DOM and update the appropriate nodes through AJAX.

If you're not familiar with the DOM and AJAX click here.

Edited by Fbody: n/a

0

It sounds like you are simply calling the function and having it output to the browser which is not sufficient.

You need to use the DOM and update the appropriate nodes through AJAX.

If you're not familiar with the DOM and AJAX click here.

Thanks for your reply Fbody,
I knew it was possible with AJAX but i wondered if anyone managed to solve these problems (displaying some text/image/value somewhere else on the screen) with php itself... For example by entering coordinates or something like that...

0

It'd be interesting to find out, but without reloading the whole page, I doubt it.

PHP is strictly server-side, it can't interact with a client's existing DOM tree that I know of. Its primary role is to store things and look them back up. Once it's done that it belches out what is required. JavaScript handles most of the client-side stuff.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.