$.post(ajaxurl,{
action:'master_ajaxurl',
option: $(this).find("option:selected").val(), // use option also here
},
function(data){
//adds the echoed response to our container
// alert(data);
$("#details").html(data);
}
);
Move action and functions into function.php file
make some changes as commented
add_action('wp_ajax_master_ajaxurl', 'master_ajaxurl');
add_action('wp_ajax_nopriv_master_ajaxurl', 'master_ajaxurl');
function master_ajaxurl() {
$myOpt = $_POST['option']; // use option instead of data
echo bringDetails($myOpt);
die();
}
**page.php** $(document).ready(function () { var ajaxurl="----admin_url----"; $('#combobox').click(function(){ $.post(ajaxurl,{ action:'master_ajaxurl', option: data to send, // key => value option2: 'hello' }, function(data){ //adds the echoed response to our container alert(data); //$("#details").html(data); } ); }); }); **functions.php** function master_ajaxurl() { $myOpt = $_POST['option']; echo bringDetails($myOpt); die(); } must use echo and die() in your ajax output function. this is working for me. Hope this works now.