I am still improving my AJAX and I ran into something that I'm not sure
how to do.
I will have a page called where I will have a dropdown list at the top
and a large display at the bottom. The display depends upon what is
currently selected in the dropdown. This is readily done via AJAX which
is activated with an onchange in the dropdown list. The contents of the
bottom half of the page are created in the php script which is sent back
to the response handler which changed the bottom part via an innerHTML.
So far OK. What I would also like to happen is that when the page is
called initially, that the bottom half shows for the first entry of the
dropdown list. I don't want to repeat code in two places.
One solution I have is to have the entire selection and bottom building
part be an include file that I put into both my AJAX server php script
and into this display page. I would just use different values for the
selected item. It would be on the display page as a require_once before
I do any html display.
My question is whether there is some better way.
how to do.
I will have a page called where I will have a dropdown list at the top
and a large display at the bottom. The display depends upon what is
currently selected in the dropdown. This is readily done via AJAX which
is activated with an onchange in the dropdown list. The contents of the
bottom half of the page are created in the php script which is sent back
to the response handler which changed the bottom part via an innerHTML.
So far OK. What I would also like to happen is that when the page is
called initially, that the bottom half shows for the first entry of the
dropdown list. I don't want to repeat code in two places.
One solution I have is to have the entire selection and bottom building
part be an include file that I put into both my AJAX server php script
and into this display page. I would just use different values for the
selected item. It would be on the display page as a require_once before
I do any html display.
My question is whether there is some better way.
Comment