I am a beginner in joomla .I have a contact form in the front end where i want to get the dropdown of states when a country is selected.This contact form display is at myproject/components/com_contact/views/contact/tmpl/default_form.php . I have a country drop down there . I want to make an ajax call to the function filterState() in the controller of contacts . this is my ajax code
`<script>
$( document ).ready(function() {
$( "#jform_contact_country" ).change(function(){
var id = $( "#jform_contact_country option:selected" ).val();
alert(id);
$.ajax({
url: "index.php",
data: 'option=com_contact&task=filterState()&country_id='+id,
success: function(data) {
alert('succes');
}
});
});
});
</script>`
method filterStae is inside the contact.php which is inside myproject/components/com_contact/controllers/ . But when i change the country this function is not called and call goes to index.php and is not going to this page ? how to actually invoke this function ?