更新的元标记未显示在社交分享facebook - backbone.js上

时间:2016-08-10 12:33:44

标签: javascript facebook backbone.js

我的index.html有一些元标记,在Backbone视图中我正在尝试更新它们。

public ActionResult IndexByPartyToken(string id)
{
    var t_Group = db.T_Group.Where(g => string.IsNullOrEmpty(id) ||
                                        g.T_Party.Contains(db.T_Party.Where(p => p.PartyToken == id).FirstOrDefault()))
                            .Select(g => new { ID = g.GroupId, GroupText = g.GroupText });

    return Json(t_Group, JsonRequestBehavior.AllowGet);
}

内部渲染:

@model IEnumerable<EasyKnowMVC.Models.T_Thread>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutMaster.cshtml";
}
@using X.PagedList.Mvc; 
@using X.PagedList;

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>

@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "searchThread" }))
{
    <p>
        Seach By Thread Title : @Html.TextBox("threadTitle") 
        Party : @Html.DropDownList("partyToken", (SelectList)ViewBag.Parties, "All", new { id = "ddlPartySearch" }) 
        Group : @Html.DropDownList("groupId", (SelectList)ViewBag.Parties, "All", new { id = "ddlGroupSearch" }) 
        <input type="submit" value="Search" />
    </p>
}

<table class="grid">
    <tr class="head">
        <th>
            @Html.ActionLink(@Html.DisplayNameFor(model => model.ThreadText).ToString(), "Index", new { sortOrder = ViewBag.ThreadTitleSortParam })
        </th>
        <th>
            @Html.ActionLink(@Html.DisplayNameFor(model => model.ThreadImportance).ToString(), "Index", new { sortOrder = ViewBag.ImportanceSortParam })
        </th>
        <th>
            @Html.DisplayNameFor(model => model.IsActive)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.IsLocked)
        </th>
        <th>
            @Html.ActionLink(@Html.DisplayNameFor(model => model.ExternalToken).ToString(), "Index", new { sortOrder = ViewBag.ExternalTokenSortParam })
        </th>
        <th>
            @Html.ActionLink(@Html.DisplayNameFor(model => model.T_Group.GroupText).ToString(), "Index", new { sortOrder = ViewBag.GroupNameSortParam })
        </th>
        <th>
            @Html.ActionLink(@Html.DisplayNameFor(model => model.T_Party.PartyName).ToString(), "Index", new { sortOrder = ViewBag.PartyNameSortParam })
        </th>
        <th>
            @Html.DisplayNameFor(model => model.T_User.PartyToken)
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.ThreadText)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ThreadImportance)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.IsActive)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.IsLocked)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ExternalToken)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.T_Group.GroupText)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.T_Party.PartyName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.T_User.PartyToken)
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.ThreadId }) |
                @Html.ActionLink("Details", "Details", new { id = item.ThreadId }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.ThreadId }) |
                @Html.RouteLink("Posts", new { controller = "Posting", action = "Index", Id = item.ThreadId })
            </td>
        </tr>
    }
</table>

<div>
    @Html.PagedListPager((IPagedList)Model, page => Url.Action("Index", new { page }))
</div>

<script type="text/javascript">
    $(function () {
        $("#ddlPartySearch").change(function () {
            $.ajax({
                cache: false,
                type: "GET",
                url: "GroupMaintenance/IndexByPartyToken",
                data: { "id": $(this).val() },
                success: function (data) {
                    var ddlGroupSearch = $("ddlGroupSearch");

                    ddlGroupSearch.empty();

                    ddlGroupSearch.append(new Option("All", ""));

                    $.each(data, function (id, option) {
                        ddlGroupSearch.append(new Option(option.GroupText, option.ID));
                    });

                    ddlGroupSearch.trigger("chosen:updated");
                },
                error: function (xhr, ajaxOptions, thrownError) {
                    alert('Failed to retrieve groups.');
                }
            });
        });
    });
</script>

请帮忙

https://developers.facebook.com/tools/debug/sharing

0 个答案:

没有答案