how to connect php database file in javascript? -


i have using jvector map default jvector map working hover function.now changed hover click function.but want display country details database.i have created php database? don't know how call database php file?

code:

<!doctype html> <html>  <head>   <title>country footprint</title>   <link rel="stylesheet" media="all" href="../jquery-jvectormap.css"/>   <script src="assets/jquery-1.8.2.js"></script>   <-- jvectormap scripts here -->   <script>     jquery.noconflict();     jquery(function(){       var $ = jquery;       $('#focus-single').click(function(){         $('#map1').vectormap('set', 'focus', {region: 'au', animate: true});       });       $('#focus-multiple').click(function(){         $('#map1').vectormap('set', 'focus', {regions: ['au', 'jp'], animate: true});       });       $('#focus-coords').click(function(){         $('#map1').vectormap('set', 'focus', {scale: 7, lat: 35, lng: 33, animate: true});       });       $('#focus-init').click(function(){         $('#map1').vectormap('set', 'focus', {scale: 1, x: 0.5, y: 0.5, animate: true});       });        $('#map1').vectormap({         map: 'world_mill_en',         panondrag: true,         focuson: {           x: 0.5,           y: 0.5,           scale: 1,           animate: true         },         series: {           regions: [{             scale: ['#688fa0'],             normalizefunction: 'polynomial', 

the answer easy need more coding.

first of need realize, javascript application can't connect database directly (and if could, you'd have store database credentials in js app , reveal them out there).

javascript apps data using ajax - need have webserver configured @ endpoint (eg. http://example.com/getdata.php) returning json response. can loaded in js app.

the getdata.php script simple php script, connects database , selects required data , encodes them json , writes output (don't forget add content-type: application/json header).


Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -