Friday, 20 May 2016

Call back functions in ASP.Net MVC using Jquery


HomeController 

using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace ScriptLearning.Controllers
{
public class HomeController : Controller
{   
// GET: Home     
public ActionResult Index()
{
            return View();
        }
     }
}



View

@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<button class="buttonId">Click me</button><br /><br />
<div class="div1"> </div>
<style>
.div1 {
margin : 10px;
background: orange;
width :100px;
height:30px;
border: grey 2px solid;
}
</style>





Client.js 


$(document).ready(function () {
    $('.buttonId').click(function () {
        $('.div1').animate({ width: '400px', height: '400px' }, 1000, (function () {
            $(this).fadeOut(2000, (function () {
                $(this).fadeIn(1000, (function () {
                    alert(' Thanks for your time');
                }));
            }));
       
}));
   
});
});

No comments:

Post a Comment