473,397 Members | 1,985 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,397 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 1568
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.