473,320 Members | 1,695 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,320 software developers and data experts.

I need to mix PHP and JS to do a task involving DHTML

14
Expand|Select|Wrap|Line Numbers
  1. function callPHPHead(s, m, y, d) {
  2.   var xhttp = new XMLHttpRequest();
  3.   xhttp.onreadystatechange = function() {
  4.     if (xhttp.readyState == 4 && xhttp.status == 200) {
  5.      document.getElementById("idMo").style.display = "block";
  6.      document.getElementById("idMo").innerHTML = xhttp.responseText;
  7.     }
  8.   };
  9.   var c = "head.php?m="+m+"&y="+y+"&d="+d;
  10.   xhttp.open("GET", c, true);
  11.   xhttp.send();
  12.   callPHPScript(s+".php",m,y,d);
  13. }
  14.  
  15. function callPHPScript(url, m, y, d) {
  16.   var xhttp = new XMLHttpRequest();
  17.   xhttp.onreadystatechange = function() {
  18.     if (xhttp.readyState == 4 && xhttp.status == 200) {
  19.      document.getElementById("showMo").innerHTML = xhttp.responseText;
  20.     }
  21.   };
  22.   var c = url+"?m="+m+"&y="+y+"&d="+d;
  23.   xhttp.open("GET", c, true);
  24.   xhttp.send();
  25. }
  26. </head>
  27. <body onload='callPHPHead("month",<? echo $m . "," . $Y . "," . $d; ?>)'>
  28.  
  29. <div id="idMo" class="w3-modal">
  30. <p id="showMo"></p>
  31. </div>
  32.  
  33. </body>
  34. </html>
I get a weird error where I'm missing a bracket or one too many and there's no code there. It's on line one, and two. where I have <html>, <head> respectively.
Apr 16 '16 #1
2 4240
Dormilich
8,658 Expert Mod 8TB
the first thing you need to understand is that PHP only runs on the server. i.e. you need to make a new request to get the PHP working.
Apr 17 '16 #2
aunk
14
Yea, I got the JS to get it going. I knew that about PHP. I got to having the modal pop out. That was pretty cool. Now I'm using another JS func to rerun the page. Going to see what I can do today.
Apr 17 '16 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Johnny Knoxville | last post by:
I've added a favicon to my site (http://lazyape.filetap.com/) which works fine if you add the site to favourites the normal way, but I have some JavaScript code on a couple of pages with a link,...
2
by: mr_burns | last post by:
hi there, i would like a book that will explain concepts of javascript and dhtml instead of, for example, ten tutorials on how to do specific things in js or dhtml. ideally a book thats can...
18
by: Andromeda | last post by:
I've been trying to add a tree menu to my website with some luck (more or less). I came across a script on simplythebest.net, but I seem to be having a problem with it... and since they have no...
2
by: Kevin | last post by:
Hi, I am looking for a Task Scheduler with source code that has the following features: - Must perform all of the same functions as the Windows Task Scheduler - Must be able to run COM...
1
by: gimme_this_gimme_that | last post by:
What I need is the DHTML for an input box that allows javascript to add drop down entries. .... I'd like to create my own version of google suggest GS. If you haven't seen GS check it out...
7
by: bayfaulkscatering | last post by:
I'm definitely not new to JS, but for the life of me, I can't figure this one out. Here's basically what I'm doing: function foo() { alert(this); } span = document.createElement('span'); a...
10
by: samuelberthelot | last post by:
Hi, I have the following code that shows up a div with an animated gif inside, executes a cpu intensive function using setTimeout and then hide the div again: getEl('divWaiting').style.display...
11
by: ontherun | last post by:
hi, i am new to access and have little knowledge in database. i have been given a task to create a database involving client (a company request for a job) and job . Primary key for Client is ABN...
0
by: boomertoo55 | last post by:
Trying to exec DTS task involving load of MS Access table to SQL Server 2000 table using Data Pump task via remote exec of xp_cmdshell command of dtsrun. That is, on client, connect to database...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.