Select box Ajax
============
$("#edit-model").change('change',function(){
var option=$('#edit-model').val();
if(option == "Add")
{
$("#searchShowHide").show();
}
else
{
$("#searchShowHide").hide();
$.ajax ({
type: 'POST',
url: Drupal.settings.basePath+"?q=dropdown",
data: {option:option},
success: function(response)
{
$('#edit-varint').html(response);
}
});
}
});
menu link
==========
$items['dropdown'] = array(
'title' => 'dropdown',
'page callback' => 'getvariants',
'page arguments' => array(),
'access arguments'=>array('access content'),
'menu_name' => 'main-menu', // This is the changed line.
'type' => MENU_CALLBACK,
);
Function
========
function getvariants()
{
$name=$_POST['option'];
$result=db_query("select a.field_variant_name_value as name,a.entity_id as id from field_data_field_variant_name a,field_data_field_model_variant b,field_data_field_newmodel c where b.entity_id =a.entity_id and c.entity_id=b.field_model_variant_nid and c.entity_id='$name'");
print "";
if($result->rowCount()>0)
foreach($result as $row)
{
print "";
}
print "";
}
legends
========
edit-model---first selectbox id
edit-varint--second selectbox id