ajax pass variable to function code example
Example: passing data variable using ajax
var myVar = "test";
$.ajax({
url: "test.php",
type: "POST",
data:{"myData":myVar}
}).done(function(data) {
console.log(data);
});
var myVar = "test";
$.ajax({
url: "test.php",
type: "POST",
data:{"myData":myVar}
}).done(function(data) {
console.log(data);
});