How do I update an div css to display an complete image when section is complete?


Tags: css,asp.net-mvc-3,asp.net-ajax

Problem :

Using MVC 3

I have a questionaire that has three sections. The page that contains the questionaire has a "next","previous" and "save" button? When I click any of these buttons I want an ajax call to an Actioncontroller called "Question/SectionComplete" if it returns true I want to update menu div with the css that displays complete icon. Can anyone help get started with sample code?



Solution :

function onButtonClick(){
    var data = { myvar: 1 }; // your data to pass to action
    $.getJSON('Question/SectionComplete', data, function(result){
        if(result)
            $('#mymenudiv').css('background-image', 'yourImage'); //your styles here
    })
}

In controller:

public ActionResult SectionComplete(int myvar)
{
    // check condition
    return Json(true, JsonRequestBehaviour.AllowGet); // you can return complex object instead
}

    CSS Howto..

    How to get a reference to id=“xxx.yyy” in CSS?

    How can I show part of an element, and toggle to all of the element on click?

    How to overlap 2 charaters with CSS

    how to center background image in window resize

    How to fix a glitchy header collapsing to nav bar

    How do i get the submenus to show with a small window size?

    How to style Flipview as inline-block?

    How can I change the entire background color of a page?

    How to use Vendor Properties in Multiple Backgrounds?

    How do I add multiple linear-gradients to a css background? If

    How to call css styles in specific page in HTML?

    How do I apply odd/even styles to elements while taking into account excluded classes? [duplicate]

    How to display print preview as same as the webpage using css?

    How to use toggle css classes on an element onclick?

    How to know where a CSS error occurred in dynamic content or how to stop the script upon CSS error

    How do I make this CSS work to have semi-transparent border?

    How to build a simple CSS layout that expands to the viewport?

    How can I change input type of Yii CJuiAutoComplete?

    How to fix internet explorer 9 overflow with form elements displayed in a list and “display:table”-based layout

    PNG background image not showing in IE 8< using html5?

    How to identify device to make separate css for iPad and Galaxy Tab?

    How to detect if content have more then one line in Angular?

    How to make a Elastic Vertical Layout?

    Show nested list on click in Joomla (1.7.0)

    How to Add Another Instance of Date picker in given Code

    How to Position a CSS Element on the page? Without position properties?

    How to use a global parent selector with CSS Modules

    How to expand sidebars sub-menu to the correct size?

    In CSS, how to hover a background over an image

    How do I use CSS with a ruby on rails application?