user2234992
user2234992

Reputation: 575

sending variables via ajax

i have sent values of form fields are sent using val().. i want to send plain php variables to via ajax, this is id values

   var dminute= $("#dminute").val();

var dataString = 'dminute='+ dminute + '&dhour=' + dhour + '&minuteid1=' + minuteid1+ '&hourid1=' + hourid1+ '&datepicker=' + datepicker;

for php variable, how should i send?

   var dminute=$dminute; 

is a wrong syntax.. If someone would, tell how to send this..Thanks in advances..

Upvotes: 0

Views: 59

Answers (2)

bipen
bipen

Reputation: 36551

you can use php tags.. if your codes in not in seperate .js file

try this

var dminute= <?php echo $dminute ?>; 

Upvotes: 1

hop
hop

Reputation: 2558

If you want to assign your php variable to javascript var,

var dminute= <?php echo $dminute;?>;

Upvotes: 1

Related Questions