Jquery :Change event in Jquery Method:
Demo
$("#drpCountry").change(function () {
var id = $("#DrpCountry").val();
alert(id);
});
HTML
<select id="drpCountry">
<option value="">SELECT</option>
<option value="USA">America</option>
<option value="RSA">Russia</option>
<option value="JPN">Japan</option>
</select>
Jquery :selected Selector
In the below demo jQuery :selected selector to find the selected option value in the dropdown list.if ($('#drpCountry:selected').val() == "") {
alert("Please select the Country Name);
}
HTML
<select id="drpCountry">
<option value="">SELECT</option>
<option value="USA">America</option>
<option value="RSA">Russia</option>
<option value="JPN">Japan</option>
</select>
How to Post value to mvc Action method using jquery .
or
How to Post values to Web API action method using jquery .
Examplefunction DeleteUsers(userId) {
$.ajax({
type: 'POST',
url: urlString + 'User/DeleteUser/',
data: { UID: userId },
success: function (data) {
alert("Data SuccessFully Deleted");
},
error: function (xhr, ajaxOptions, thrownError) {
//ON Error
alert(xhr.status);
}
});
}
No comments:
Post a Comment