Jump to content

JoshEir

Members
  • Posts

    30
  • Joined

  • Last visited

Everything posted by JoshEir

  1. This would be neat: document.getElementById("insert").innerHTML = <?php $descriptionVar; ?>;
  2. I guess this would work: function onButtonPress() { <p> <?php echo $aVariable ?> </p> } I don't know what I was thinking, it is no replacement for AJAX.
  3. Hmm... well I found this about javascript and php together: <?php // Call PHP function from javascript with parameters function myphpfunction($x, $y){ $z=$x+$y; return 'The sum is: '.$z; } ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <script type="text/javascript"> alert("<?php echo myphpfunction(4,90)?>"); </script> </head> <body> </body> </html> Now it would seem that this does not refresh the page, I am wondering if it is as good as AJAX? And maxxd, It looks like the fetch uses a URL, am I correct? Josh I guess this would be for a return only.
  4. You might not be able to put php in javascript script, but you certainly can put them on the same page. I'm wondering how to call a php on the same page with a AJAX and not JQuery. I saw this earlier and lost the link
  5. Hello, everyone. I have code that effectively calls a PHP page with AJAX (no JQuery). The PHP responds fine with an echo. Here is the javaScript that calls the PHP so refreshing the page doesn't need to be done. function deleteCategory() { var e= document.getElementById("dropDown1"); var var1 = e.options[e.selectedIndex].text; var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = alerta() { if (this.readyState == 4 && this.status == 200) { document.getElementById("insert").innerHTML = xmlhttp.responseText; } }; xmlhttp.open("GET", "deleteRow.php?q=" + var1 , true); xmlhttp.send(); } How do I call a PHP function on the same page while preserving the above AJAX. Sincerely, Joshua
  6. My name is Joshua, am so glad to have found this site. I am using backend PHP for an ecommerce project I am working on to gain experience to help land a job. I really like PHP and the JavaScript that goes with it. Nice to be here, if there is anything I can do for you feel free to contact me.
      • 1
      • Like
  7. JoshEir

    Hello

    Hello, I am new to this forum. I am gaining experience with different languages to get an internship. I like PHP, it is very nifty. My PHP project is an ecommerce site such as something like Amazon. What a great place to share great knowledge! JoshEir
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.