Execute php from javascript -


i'm having trouble getting php code working in app. setup rather easy: 1 button, 1 function , 1 php file.

the structure

script.js

$(document).ready(function () {     $("#btntestconnectie").click(testconnectie); });  function testconnectie() {     $.get("script/sql/testconnection.php"); } 

testconnection.php

<?php echo "it works!"; php?> 

according post, should work (how run php code when user clicks on link?)

some sources claim impossible execute php via javascript, don't know believe.

if i'm wrong, can point me method work (to connect javascript/jquery script mysql database)?

thanks!

$.get('script/sql/testconnection.php', function(data) {   alert(data) }); 

you need process ajax result


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -