Halo
Halo

Reputation: 1532

Style Is Not Applied After Loading Content

I'm using jquery's ajax function to return a partial view from the server. In the success parti I'm appending it into a DIV using $.(html). But the content is loaded without any styling. I've tried different ways to append the style but got no results.

Here is the ajax, called after documentReady

        $.ajax({
        type: "GET",
        url: '@Url.Action("Accessories", "Tablo")',
        success: function (data) {
            $("#secimlerDetay").html(data);
        },
        }
    });

The return of the async call is a partial view, here:

 @model RenkliTablo.ViewModels.AccessoryViewModel

<div id="cerceveList">
    <span>Cerceveler</span>

    @foreach (var cerceve in Model.cerceveList)
    {
        <a class="cerceve" data-accessoryId="@cerceve.AccessoryId" href="/">
            <img class="accImg" alt="" src="../../Content/Images/kapcik.png" />
            <span class="accText">@cerceve.Thickness cm</span>
        </a>
    }
</div>

<div id="paspartuList"> 
    <span style="font-weight:bold;">Paspartular</span>       

    @foreach (var paspartu in Model.paspartuList)
    {
        <a class="paspartu" data-accessoryId="@paspartu.AccessoryId" href="/">
            <img class="accImg" alt="" src="../../Content/Images/kapcik.png" />
            <span class="accText" style="font-weight:bold;">@paspartu.Thickness cm</span>
        </a>
    }
</div>

As you can see, I specified a style="font-weight:bold" in the .cshtml file, but I don't see any bold text when jquery loads the partial view. The data is loaded OK, but the style is missing.

Upvotes: 0

Views: 767

Answers (1)

replace <span style="font-weight:bold;">Paspartular</span>  

with

<strong>Paspartular</strong> 



<span class="accText" style="font-weight:bold;">@paspartu.Thickness cm</span>

with

<span class="accText"><strong>@paspartu.Thickness cm</strong></span>

Upvotes: 1

Related Questions