473,387 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

php generate HTML, but being called by javascript

I've been searching for few days trying to find an answer to my
question... hopefully I ofund the right place to help me out!

What I am trying to do is use javescript inside column of a <table>
tag, to call a php file that will fill in the contents for my column
and the html page will then finish loading... For example:
<html>
<tr>
<td valign="top">
<script type="text/javascript"
src="dir/external.php?"></script>
<script language="" type="text/javascript">
<!--
for (x = 0; x < 10; x++)
{
document.writeln("<a href=data returned from php call >

</a>");
}
//-->
</script>
</td>
</tr>
</html>
To give you all a background of what I am doing is, I am using
MagpieRSS to parse out my XML file and I would like to have my php file

generate an array of data from the parsed file to return back to the
javascript in my HTML file and use it to fill in my column... make
sense?
Thanks in advance for any help!
Regards,
Me

Nov 10 '06 #1
2 1567
c.********@cox.net wrote:
I've been searching for few days trying to find an answer to my
question... hopefully I ofund the right place to help me out!

What I am trying to do is use javescript inside column of a <table>
tag, to call a php file that will fill in the contents for my column
and the html page will then finish loading... For example:
<html>
<tr>
<td valign="top">
<script type="text/javascript"
src="dir/external.php?"></script>
<script language="" type="text/javascript">
<!--
for (x = 0; x < 10; x++)
{
document.writeln("<a href=data returned from php call >

</a>");
}
//-->
</script>
</td>
</tr>
</html>
To give you all a background of what I am doing is, I am using
MagpieRSS to parse out my XML file and I would like to have my php file

generate an array of data from the parsed file to return back to the
javascript in my HTML file and use it to fill in my column... make
sense?
Thanks in advance for any help!
Regards,
Me
You can't do it like you want. PHP is executed on the server, before
the page loads. Javascript is executed on the client, after the page
loads. By the time your javascript starts executing, all of your PHP
code has been executed.

Two ways to go about this - either write all the data to the page as
javascript code (i.e a javascript array), or use AJAX to call PHP back
on the server.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 10 '06 #2
Thanks for the reply!

Nov 20 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mike | last post by:
I am just wondering if it is possible to save a HTML string from PHPs? Let me elaborate more on what I mean. If you do <?php include 'abc.php' ?> //abc.php <html>
0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
18
by: Arthur Connor | last post by:
Is there a way of extracting the Javascript code from the "normal" HTML code (e.g. similar to CSS code which can be put into a separate file) ? If you offer a solution: can I determine in your...
9
by: Robby Bankston | last post by:
I'm working on some code and am running into brick walls. I'm trying to write out Javascript with Javascript and I've read the clj Meta FAQ and didn't see the answer, read many similar posts (with...
2
by: Jake Barnes | last post by:
Using javascript closures to create singletons to ensure the survival of a reference to an HTML block when removeChild() may remove the last reference to the block and thus destory the block is...
3
by: rockdale | last post by:
Hi, All: I have a datagrid with TemplateColumn as following: <asp:TemplateColumn Visible="False" > <ItemStyle Width="0px"></ItemStyle> <ItemTemplate> <asp:Label id="lblMin_Value"...
1
by: firenet | last post by:
21 function js_reply_msg(node,g_id,u_id,par_id) 22 { 23 node.innerHTML="<FORM><TEXTAREA name=\"msg_con\"><\/TEXTAREA><br><INPUT type=\"submit\" value=\"reply\"><\/FORM>" 24 ...
0
by: c.l.rogers | last post by:
I've been searching for few days trying to find an answer to my question... hopefully I ofund the right place to help me out! What I am trying to do is use javescript inside column of a <table>...
10
by: mark4asp | last post by:
I ask this because only today I read advice telling me to put it within the <headelement. This is the same advice I've always been given but no one ever explained why. Last week I was told to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.