How to enable Javascript in PHP
I use the ActiveXObject object for FireFox as my HttpRequest to call a page test.php
But I noticed that whenever i run javascript my page gets executed as test.php. Which is suppose is a BIG problem.I have read many things but nothing is similar to it, I can not execute the javascript code in test.php. Can someone how to use it?
I try to display an alert in test.php,but nothing goes in the positive way.
Re: How to enable Javascript in PHP
I think you cannot implement PHP and JavaScript on the same machine, you need to implement javascript on the client machine and php on the server, they are never executed at the same time (very bad words but I will attempt a example)
Try something like this:
Code:
$ str = "alert ( 'yep');"
echo $ str;
Re: How to enable Javascript in PHP
To enable JavaScript support in new PHP Projects follow the following steps:
- Go to File Menu and select New | PHP Project.or you may also try using the PHP Explorer view, right-click and select New PHP Project.
The new PHP Project wizard will launch.
- The New page will get open and you can enter the required information in the various fields.
- To enable JavaScript support for your current project, mark the 'Enable JavaScript support for this project' in the checkbox this will allow to open the new projects in the javascript.Click Finish.
Re: How to enable Javascript in PHP
Here i will provide you the javascript code for your project.
Code:
function sendData (cpt)
(
if (document. all) (
xhrObj var = new ActiveXObject ( "Microsoft.XMLHTTP"); / / Internet Explorer
)
else (
xhrObj var = new XMLHttpRequest () / / Mozilla
)
XhrObj. Open ( 'GET', 'test.php', true);
xhrObj. send ('');
XhrObj. Onreadystatechange = function () (
if (readyState xhrObj.! = 4) return;
eval (responseText xhrObj.);
);
)