Another stupid newbie question
What I have:
My Index site
<% if (Model.Data != null)
{
if (Model.Data.Rows.Count > 0)
{
var divLoadGif = string.Empty;
var divRealData = string.Empty;
for(int n = 0; n < Model.Data.Rows; n++)
{
divLoadGif = "divLoadGif_" + n.ToString("0000");
divRealData = "divRealData_" + n.ToString("0000");
%>
<div id="<%:divLoadGif%>" style="width: 100%;">
Please wait ...
<img src="/loading.gif" alt="loading ..." />
</div>
<div id="<%:divRealData%>" style="visibility: hidden;">
<div id="column_1" style="width: 25%; float:left;">
This
</div>
<div id="column_2" style="width: 25%; float:left;">
is
</div>
<div id="column_3" style="width: 25%; float:left;">
a test
</div>
<div id="column_4" style="width: 25%; float:left;">
row.
</div>
</div>
<script type="text/javascript">
AsyncFunction(<%: divLoadGif %>, <%: divRealData %>, n);
</script>
<% }
}
}
%>
The controller fills my Model.Data.
Lets make an example:
Model.Data.Row should be equal to 3.
Means the loop will make 3 "rounds".
The idea is that in each "round" a loading gif should be displayed while the div part (with the 4 columns) is in-visible.
Then should the javascript function "AsyncFuntionCall" be called. (AND THIS FAILED!)
This javascript function becomes two "div tag ids" and "n" (variable of the for loop).
The javascript function will use ajax to call a controller method.
The controller method gets also the div tags and "n".
Finally will the controller method 3 times called.
The controller method will return a "result" for every call.
Every call will need some seconds before it returns a result to the ajax functionality.
The "success: function (result) { result = $.parseJSON(result); ...}" part of my ajax call will then
parse result,
switch the "div" with "id="<%:divLoadGif%>" to hidden,
switch the "div" with "id="<%:divRealData%>" to visible
and
- replace the 4 "values" with the parsed values from "result" .
Easy? Or? Not for me :-( because I have some problems:
1.) The loop works very fine. But the javascript function "AsyncFunction" isnt called at all! Whats wrong?
2.) I have absolut no idea how I can change the "This" "is" "a test" "row" values in the "success: function (result) { result = $.parseJSON(result); ...}" part of my ajax call.
Any help would be great! Thank you in advance!