javascript - i am trying to fetch data from mysql to node.js here is the issue -
here issue query
select * employee_leaves employee_leave_company_name ='$sup_company_name' , leave_status='pending' order employee_leave_id desc";
the problem here employee_leave_company_name
stored in php variable $sup_company_name
in file require.php
how should access variable in javascript
this have done far
var cmpny_name; var reqdata=["c_name" : "sup_company_name"]; var xhrobj = $.get("require.php",c_name) .done(function( response ) { cmpny_name=response;//the echo text server }) .fail(function() { alert('error'); });
but isnt working.... , here php code require.php
$sup_company_name=$_session['employee_company_name'];
try this
var cmpny_name; var reqdata=["c_name" : "<?php echo $sup_company_name; ?>"; var xhrobj = $.get("require.php",c_name) .done(function( response ) { cmpny_name=response;//the echo text server }) .fail(function() { alert('error'); });
other this, if want interact between php , javascript should use ajax.
Comments
Post a Comment