C
Cruelemort
All,
I have recently been using Ajax for a web application i am using,
currently i have an HTML page that contains a div, when this html page
is loaded a javascript function is called to use Ajax to populate the
div with data from a database (by calling a php page and setting the
innerHTML of the div to the returned html from the php page).
The php page contains code to generate html buttons to go into the
div, but depending on the data that is returned from the database this
button may need to be invisible - to do this i figured it would be
best to run a javascript function during the generation (i.e. from the
php page where the database data can be checked) but for some reason
it will not let me call a javascript function from here.
One solution i have come up with to solve this problem is to get the
php page to return a JSON string rather than an HTML string and then
the data can be checked in the javascript rather than the php, but i
do not know if this is the best way to go...
Many thanks.
Ian
I have recently been using Ajax for a web application i am using,
currently i have an HTML page that contains a div, when this html page
is loaded a javascript function is called to use Ajax to populate the
div with data from a database (by calling a php page and setting the
innerHTML of the div to the returned html from the php page).
The php page contains code to generate html buttons to go into the
div, but depending on the data that is returned from the database this
button may need to be invisible - to do this i figured it would be
best to run a javascript function during the generation (i.e. from the
php page where the database data can be checked) but for some reason
it will not let me call a javascript function from here.
One solution i have come up with to solve this problem is to get the
php page to return a JSON string rather than an HTML string and then
the data can be checked in the javascript rather than the php, but i
do not know if this is the best way to go...
Many thanks.
Ian