I have a situation here where i show initially some content in html.
I have applied responsive styles and javascript on the elements.
Now i have added an ajax call to load data at the end dynamically and for the dynamic data the styles are same which are applied for initail HTML elements.
The data is being retrieved sucessfully but the styles are not applied to it and thus the structure is messed up. Please any help would be gratefull.
My front page code:
<div id="divlist" class="span9">
@{
for (int i = 0; i < item; i = i + 3)
{
<div id="divlist2" class="row-fluid">
@if (teachersList.Count > i)
{
<div class="span4" style="height:auto">
<div class="blocks-list" style="height:auto">
@Html.DisplayFor(modelItem => teachersList[i].TeacherID). @Html.DisplayFor(modelItem => teachersList[i].TeacherName)
@*@Html.DisplayFor(modelItem => teachersList[i].StdID)*@
<div style="float: right; color: Green">
@Html.DisplayFor(modelItem => teachersList[i].Department)
</div>
<br />
@Html.DisplayFor(modelItem => teachersList[i].Notes)
<br />
</div>
</div>
}
</div>
My Script where i am calling ad retrieving dynamic content
<script type="text/javascript">
function join() {
$("#loader").hide();
}
var isPreviousEventComplete = true, isDataAvailable = true, sind=10;
jQuery(
function ($) {
$("#btn_search").click(function () {
})
$(document).scroll(function () {
if ($(document).height() - 34 <= $(window).scrollTop() + $(window).height()) {
if ((isPreviousEventComplete) && isDataAvailable) {
isPreviousEventComplete = false;
$(".LoaderImage").css("display", "block");
$.ajax({
type: "GET",
url: "/Home/DynamicP/?sind1=" + sind,
beforeSend: function show1() { $("#loader").show(); },
success: function (result) {
setTimeout(join, 700);
$("#divlist").append(result);
isPreviousEventComplete = true;
sind = sind + 3;
if (result == '')
isDataAvailable = false;
$(".LoaderImage").css("display", "none");
},
error: function (error) {
alert(error);
}
});
After the data is sucessfully appended to divlist the styles are not applied on the added html elements...
Please give any suggestions or solutions.
Thanks in advance.