Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9076449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:06:34+00:00 2026-06-16T19:06:34+00:00

i have this code in my view which is in a loop which gives

  • 0

i have this code in my view which is in a loop which gives me two rows for console.log

var jqxhr = $.getJSON("<%= Url.Action("GetTrainingModulePoints" , "Home") %>", function (data) {
      console.log(JSON.stringify(data));
   });
   <%: Html.GetQTip("training-module-id-" + module.TrainingModuleId , "With assesment"  , "training-module-id-" + module.TrainingModuleId , Zinc.Web.Extensions.QTipPosition.Bottom, true, "Module Points") %>

in my controller:

public JsonResult GetTrainingModulePoints()
{
  var currentUser = ZincService.GetUserForId(CurrentUser.UserId);
  IEnumerable<DataModels.Training.UserTrainingPointsDataModel> modulePoints = ZincService.TrainingService.GetTrainingModulePoints(currentUser.UserId);
  return Json(new { result = modulePoints}, JsonRequestBehavior.AllowGet);
}

each console.log gives:

 LOG: {"result":[{"InteractionType":6,"Points":50,"Name":"China Incentive Program"},{"InteractionType":8,"Points":1,"Name":"China Incentive Program"},{"InteractionType":6,"Points":50,"Name":"India - Q2 Incentive "},{"InteractionType":8,"Points":100,"Name":"India - Q2 Incentive "},{"InteractionType":6,"Points":50,"Name":"China - Q2 Incentive"},{"InteractionType":8,"Points":3,"Name":"China - Q2 Incentive"}]} 

 LOG: {"result":[{"InteractionType":6,"Points":50,"Name":"China Incentive Program"},{"InteractionType":8,"Points":1,"Name":"China Incentive Program"},{"InteractionType":6,"Points":50,"Name":"India - Q2 Incentive "},{"InteractionType":8,"Points":100,"Name":"India - Q2 Incentive "},{"InteractionType":6,"Points":50,"Name":"China - Q2 Incentive"},{"InteractionType":8,"Points":3,"Name":"China - Q2 Incentive"}]} 

how can i get the interactiontype,name and points seperate?

public static MvcHtmlString GetQTip(this HtmlHelper htmlHelper, string propertyName, string message, string propertyNameOverride = "", QTipPosition position = QTipPosition.Right, bool includeEvents = true, string title = "")
{
  string qtipPosition = String.Empty;

  switch (position)
  {
    case QTipPosition.Right:
      qtipPosition = "my: 'left center', at: 'right center'";
      break;
    case QTipPosition.Left:
      qtipPosition = "my: 'right center', at: 'left center'";
      break;
    case QTipPosition.Top:
      qtipPosition = "my: 'top middle', at: 'bottom middle'";
      break;
    case QTipPosition.Bottom:
      qtipPosition = "my: 'bottom middle', at: 'top middle'";
      break;
  }

  if (!String.IsNullOrWhiteSpace(propertyNameOverride))
    propertyName = propertyNameOverride;

  if (String.IsNullOrWhiteSpace(title))
    title = htmlHelper.Resource(Resources.Global.Title.Information);

  StringBuilder sb = new StringBuilder();
  sb.Append(String.Concat("$('#", propertyName, "').removeData('qtip').qtip({content: {text:"));
  sb.Append(String.Concat("'", message, "', title: { text: '", title, "', button: false }}, position: { ", qtipPosition, " }"));
  if (includeEvents)
    sb.Append(", show: { event: 'focus mouseenter', solo: true, ready: false }, hide: 'blur'");
  sb.Append(", style: { classes: 'ui-tooltip-shadow ui-tooltip-yellow' } });");

  return new MvcHtmlString(sb.ToString());
  }
}

 public sealed class MvcHtmlString : HtmlString
 {

 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:06:35+00:00Added an answer on June 16, 2026 at 7:06 pm

    Simply use the $.each() function:

    var url = '<%= Url.Action("GetTrainingModulePoints" , "Home") %>';
    var jqxhr = $.getJSON(url, function (data) {
        $.each(data.result, function() {
            var interactionType = this.InteractionType;
            var name = this.Name;
            var points = this.Points;
            // do something with those variables ...
        });
    });
    

    Here we are looping over the data.result collection in which each element represents an object having InteractionType, Points and Name properties according to the log you have shown. The $.each will obviously be executed for each element of the result collection.


    UPDATE:

    After the small discussion we had in the comments section it seems that you are doing something fundamentally wrong here. You are attempting to pass to a server side helper values that you have retrieved on the client using AJAX. That’s impossible nr it makes any sense.

    So you should be binding on the server. You shouldn’t be doing any AJAX requests at all. You should simply call your server side helper and pass it the required parameters:

    <%: Html.GetQTip(
        "training-module-id-" + module.TrainingModuleId, 
        Model.Points, 
        "training-module-id-" + module.TrainingModuleId, 
        Zinc.Web.Extensions.QTipPosition.Bottom, 
        true, 
        "Module Points"
    ) %>
    

    Now all you have to do is add this Points property to your view model:

    public string Points { get; set; }
    

    and inside the controller action that is rendering this view simply set this property. You would first query your data layer to retrieve an IEnumerable<UserTrainingPointsDataModel> and then perform some transformation on this array to convert it to a string that you want to be displayed:

    MyViewModel model = ... get the view model from somewhere
    var currentUser = ZincService.GetUserForId(CurrentUser.UserId);
    var modulePoints = ZincService.TrainingService.GetTrainingModulePoints(currentUser.UserId);
    model.Points = ... transform the original points collection to some string that you want to pass to the helper;
    return View(model);
    

    Remark: I don’t know where you took this Html.GetQTip helper but looking at its source code I am horrified. This helper doesn’t encode anything. Your site is vulnerable to XSS attacks. Never use any string concatenations to build up javascript and pass variables to functions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code in my view: echo form_label('State', 'state'); $options = array( 'No
Hi I have this code in my view.. <%=Html.DropDownList(ProductTemplate,new SelectList(Model.ProductTemplate,Value,Text))%> I know if this
I have this code: tableList = [[NSMutableArray alloc] initWithObjects:@First View,@Second View,nil]; I have synthesized
I have this code in a prepareForSegue method // Get destination view UIViewController *viewController
I have this code for my soundboard, public class soundboardActivity extends Activity { View
I have this code: hubSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int
Say I have this line of code in the view. <?php echo CHtml::activeTextField($model,'start_time'); ?>
I have this view (DetailsContainer, first class in code section of this question) with
i have a scroll view with multiple images and i am using this code.
I have the following view code which displays events, along with headers informing the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.