Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function FillCity() {
- var stateID = $("#ddlState").val();
- $.ajax({
- url: '@Url.Action("Employee", "Index")',
- type: "GET",
- dataType: "json",
- data: { state: stateID },
- async: true,
- processData: true,
- success: function (data) {
- alert("SSSS");
- },
- error: function (data) {
- alert("error");
- }
- });
- }
- public ActionResult FillCity(int state)
- {
- var cities = subbuObject.Cities.Where(c=>c.StateID == state);
- return Json(cities, JsonRequestBehavior.AllowGet);
- }
- $.ajax({
- url: '@Url.Action("YourActionNamne", "YourControllerName")',
- type: "GET",
- dataType: "json",
- data: { state: stateID },
- async: true,
- processData: true,
- success: function (data) {
- alert("SSSS");
- },
- error: function (data) {
- alert("error");
- }
- });
- url: '@Url.Action("FillCity", "Employee")'
- url: '@Url.Action("ActionName", "ControllerName", new { Area = "AreaName" })',
- public class EmployeeController: Controller
- {
- [HttpGet]
- public ActionResult FillCity(int state)
- {
- var cities = subbuObject.Cities.Where(c=>c.StateID == state);
- return Json(cities , "application/json", JsonRequestBehavior.AllowGet);
- }
- }
- <script>
- function fillCity() {
- var stateID = $("#ddlState").val();
- $.ajax({
- url: '@Url.Action("FillCity", "Employee")',
- type: "GET",
- dataType: "json",
- data: { state: stateID },
- success: function (data) {
- alert("SSSS");
- },
- error: function (data) {
- alert("error");
- }
- });
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement