dantey89
dantey89

Reputation: 2287

Put data to dynamic content using jQuery

I'm writing simple application on HTML and jQuery. It connectes to the ASP.NEt server with signalR. I have login page where the user authenticates. After success authentication content of my <div id="body"></div> is updating with load() method:

$("#body").load("_ListView.html",InitListPage());

Content of _ListView.html:

<table id="driversList" align="center">
<thead>
<tr>
    <th>Login</th>
    <th>Some Data</th>
    <th>Another Data</th>
</tr>
</thead>
<tbody>

</tbody>

</table>

What I want is to update content of my table after it has been loaded. But jQuery doesn't see my dynamic content. Even sample code wan't to work:

function InitListPage(){

 $("#driversList").css("border","3px solid red");
}

How can I resolve it ot maybe I'm doing wrong at all?

Upvotes: 1

Views: 28

Answers (1)

Rajaprabhu Aravindasamy
Rajaprabhu Aravindasamy

Reputation: 67217

Try to pass the function reference as a callBack function,

$("#body").load("_ListView.html",InitListPage);

You are calling it there, so undefined will be returned and passed as the second parameter. That is the problem with your code.

Upvotes: 2

Related Questions