Passing Javascript variable in my module file

by Rakesh Verma   Last Updated July 27, 2015 14:03 PM

How can I pass a JS variable to my module file using ajax in drupal?

var start;
start = new Date().getMinutes();
   window.onbeforeunload = function() {
     var end1 = new Date();
     var end = end1.getMinutes();
     var timespan = end - start;

This is my JS file and I want to use this "timespan" variable in my PHP file but unable to figure out how.

Tags : javascript

Related Questions

Use drupal.settings variables on javascript

Updated March 27, 2015 14:18 PM

Calling a contact form in a certain page

Updated August 23, 2015 17:03 PM

video source through jquery

Updated April 11, 2016 08:03 AM