I've seen some comparable posts on this, but nothing quite that mimics the behavior I am looking for. With my simple ASP.Net app, the results of a Controller method are stored in TempData when the form is submitted. Based on the existence of a value in that slot, I want to change (set) the CSS class of a tag (to change the color). I have the following View code that does work:

```
 <p>
    <input type="submit" name="submitAction" value="Test Connection" />
    @if (TempData["connectionResults"] != null)
    {
        <span class="@(TempData["connectionResults"].ToString() 
                         == "Connection successful" ?
                            "dbConnectionSuccess" : "dbConnectionFail")">
           @TempData["connectionResults"]
        </span> 
    }
    </p> 

```

My question is, is there a more elegant way of doing this with javascript or jQuery? There are a lot of posts on SO that do comparable things, but not on the result of an action call in a controller.

Thanks!