Trying for a few days to do this and do not know why it does not work.
I want to run a php file using js. And using the event button onclick. Thanks for help
file.php

<?php
echo"<script>alert(\"good\");</script>";
?>

file.html

<!DOCTYPE html>
    <html>
    <head>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script>
$(document).ready(function () {
$('#jabutton').bind('dblclick', function(){
$.get('file.php', function(){
alert('work good');
});
});
});
    </script>    
  </head>
    <body>
	<?php
        //this don't work and I don't know what change, I have to use"echo"
	echo "<script><button onclick=\"jabutton\">Run</button></script>";
	?>
    </body>
    </html>
echo '<button onclick="jabutton">Run</button>';

You can't put an <button> inside an <script>.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.