Click here to Skip to main content
16,020,633 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
@foreach(var sQ in Model.SubQuestions.Where(s => s.QuestionId == item.Id).ToList())
                                      {

                                          counter++;

                                          var answer = Model.Answers.FirstOrDefault(a => a.SubQuestionId > 0 && a.SubQuestionId == sQ.Id);

                                          string ddlSelected = "";
                                          string rate = "0";
                                          if(answer != null)
                                          {
                                              var array = answer.Answer1.Split(',');
                                              ddlSelected = array[0];
                                              rate = array[1];
                                          }
                                          else
                                          {
                                              ddlSelected = "Select One";
                                          }

                                          <tr style="color:#37589d">
                                              <td>
                                                  @Html.DisplayFor(x => sQ.Text)
                                              </td>
                                              <td>
                                                  <div id="@sQ.Id" class="dropdown ddlparent">
                                                      <button style='font-size:10px;width:135px;border-color:#5F6E7D;background-color:#5F6E7D' class='btn btn-success dropdown-toggle' type='button' data-toggle='dropdown'>
                                                          <span data-id="postRateScore-@counter" class="selection" style="font-size:12px" data-score="@rate">@ddlSelected</span>
                                                          <span class='caret'></span>
                                                      </button>

                                                      <ul class='dropdown-menu dropdown-menu-right dropdown'>

                                                          @foreach(var r in Model.PostRatings.Where(x => x.SubQuestionId == sQ.Id).ToList())
                                                          {
                                                              <li><a href="#" id=@r.Id data-value=@r.RatingValue data-qid='@sQ.QuestionId' data-sqid='@sQ.Id'>@r.QuestionText</a></li>
                                                          }

                                                      </ul>
                                                  </div>
                                              </td>
                                              <td>
                                                  <span></span>
                                              </td>
                                          </tr>
                                      }

</td>

What I have tried:

I clean up the code whatever i had tried before. What i want is on successful ajax call i need to have class
class="glyphicon glyphicon-check"
on span tag. What I am trying to achieve is that I need to show something that will let user know that value has been saved/updated. In this case a tick mark.
Posted
Updated 30-Jan-18 18:45pm
v3
Comments
j snooze 30-Jan-18 17:14pm    
with only one line of javascript I'm not sure I totally get what you're doing, but why wouldn't you just have a css class where the opacity is 1, and change the table cell class from prgTickMark to the new opacity class?
istudent 30-Jan-18 23:09pm    
let me improve my question
j snooze 31-Jan-18 17:34pm    
I don't see the ajax call at all. All you posted was the c# of a view (I'm assuming mvc?)

You need to do something like this for your ajax call. Its not exact code but you can google around for anything additional you need for posting data to a url.

$.ajax({
url: //**Your ajax save url here,
success: function() {
//**change class of table cell here
}
});
Sinisa Hajnal 1-Feb-18 9:03am    
this!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900