There are two JavaScript variables in my index.html page. I want to use these two variables in control.js.
index.html has some jQuery script like below
<script>
$(document).ready(function() {
// load select code from country.html
$('#selectCourse_country').load('country.html select', function() {
// when country is selected
$('#selectCourse_country select').change(function() {
// get id
var countryId = $(this).children('option:selected').val();
// load select code from state.html by id
$('#selectCourse_state').load('state.html #'+countryId,function(){
$('#selectCourse_state select').change(function(){
var stateId = $(this).children('option:selected').val();
//alert(stateId);
});
});
});
});
});
</script>
I want to use value of variables countryId and stateId in control.js. How can I pass them from index.html to control.js.