Re: load in a php page from javascript



Hywel Jenkins wrote:
In article <440064ae$1@xxxxxxxxxxxxxxxxxxxx>, acord@xxxxxxxxxxxxxxxxx says...

acord wrote:

Hi,

In a html page, I don't know how to load in a php page from javascript. I've already defined a <div id="treemenu"> in the html page. The executed content from the php script is supposed loaded into the treemenu div. What is the best way to achieve this? I got error where the treemenu didn't close/open on the treenode, as when I clicked on the treenode, it said Object not found. But if I don't use ajaxpage() javascript function, and copy the content of the php script under the <div id="treemenu"> section, the treemenu works well.

Here is the javascript functions I m using to load a php script:


<snipped a load of rather badly written code />

So what? From the code you've posted how are we to determine what your PHP script outputs?

It's always difficult (or impossible) to show the output of the php code, coz the output invoke other javascript libs. I found that if I use javascript (ajaxpage()) to load the php script into the div treemenu section, the php code will not call the javascript functions. But if I put the php codes inside the div treemneu section, the php code invoke the javascript functions (from the lib), then I can click the tree node of the menu.

I suspect there is some sequential order when using javascript invoke the php script in a html file. In my example, I created html script, then defined a div treemenu, then load the php script at the end of the html script, eg:

<HTML>
....
<div id="treemenu">
</div>

<script language="JavaScript" type="text/javascript">
ajaxpage('treemenu.php', 'treemenu');
</script>

</HTML>

I created this file with php extention, (eg. test8.php).
I suspect this order is not right. I also tried .html file extention name, but still not help.

Thanks
A
.



Relevant Pages

  • Attempt to de-mystify AJAX
    ... A javaScript enabled web browser. ... One of the first things to happen is toward the last in the html code: ... Set the onReadyStateChange handler to our processChange() function ... I like PHP so our example uses php. ...
    (comp.databases.pick)
  • Re: MV by Phone and Cross-Platform MV connectivity
    ... And you believe the operators are going to do their own thing in PHP / ... Javascript & HTML ... where are *any* services set up by Pick hosts. ...
    (comp.databases.pick)
  • Simple Javascript replace (with a twist!) of an href
    ... know this isn't that hard, i'm just a little new to javascript, and I ... so I need to change the href of a link on our php driven auction ... The reason I need to do this is that the html parser used by our ... I have spent hours searching and testing with no luck. ...
    (comp.lang.javascript)
  • Re: Doing a Text comparison
    ... So if a job description has (PHP, JSP, ColdFusion, HTML, Javascript) ... Or someone puts ColdFusion in the description and in the resume there ...
    (comp.lang.java.help)
  • Re: Form to JavaScript.
    ... What the solution to pass html form from PHP to javascript function. ... escapeJS() example, and we'll have a nice discussion about that;-) ...
    (comp.lang.javascript)