I would like to send some data by using jquery ajax function to my PHP file.
I have created such function:
function ajax_call (url, select, select_name)
{
$(select).change(function () {
$(".result").fadeIn(400).html('<img src="ajax-loader.gif"/>');
var select_value = $(this).val();
$.ajax({
type: 'POST',
url: url,
data: { select_name : select_value },
success: function(data){
$(".result").html(data);
}
});
});
}
I call it:
ajax_call ('url path to my PHP file', '#my_select_div', 'my_data_name');
I have problem with this part:
data: { select_name : select_value }
I would like to get:
$_POST['my_data_name']
but I'm getting:
$_POST['select_name']
Any ideas?
Thanks for your answers.