Reputation: 185
$.ajax({
type: "POST",
url: "Check_Country.php",
data: "{Country_name: "+Country_name+"}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(html){
$('select#Section').empty();
$('select#Section').append('<option>Select</option>');
$('select#Section').append(html);
}
});
How do you detect Country_name in Check_Country.php file? I am using
$_POST['Country_name'];
in php file but, the console says that it cannot find Country_name
.
Upvotes: 0
Views: 87
Reputation: 559
Try to use
data: "{Country_name: "+Country_name"}"
instead of
data: "{Country_name: "+Country_name+"}"
i.e. remove the trailing +
sign.
Upvotes: 2
Reputation: 456
In your code only one syntax is wrong you have to change this code :-
data: "{Country_name: "+Country_name+"}",
into
data: {"Country_name": Country_name}
or
data: "Country_name="+Country_name,
please try this:-
Upvotes: 0