I have an asp.net-mvc site and I use the below javascript library for a photos page to put borders around all of my photos
http://www.netzgesta.de/instant/
i just changed my site to load my photos via ajax instead of reloading the whole page and although when i debug it the correct html is built up, i dont see any of the images:
<div id="status">
<% Html.RenderPartial("AlbumGrid",Model); %>
</div>
the change i made was to take all of the links like this:
<a href='Album?Page=" + i + "&AlbumName=" + albumName_ + "'>" + i + "</a>");
and change it to this and using ajaxhelper class:
Ajax.ActionLink(i.ToString(), "Album?Page=" + i + "&AlbumName=" + albumName_, new AjaxOptions { UpdateTargetId = "status", LoadingElementId = "updating"}));
I know it has something to do with this instant.js library because it breaks when i have this:
<img class=\"instant ishadow50\" src=\"...">
but if i remove the class above, and just load images regularly, everything works fine (but i dont get the border effect of course). So this below works fine.
<img src=\"...">
Has anyone tried using this library with ajax successfully?
EDIT: I have added full source below (stripping down to the minimum):
<head>
<script type='text/javascript' src='../../Scripts/jquery-1.3.2.js'></script>
<script type="text/javascript" src="../../Scripts/instant.js"></script>
<script type="text/javascript" src="../../Scripts/cvi_instant_lib.js"></script>
<script type="text/javascript" src="../../Scripts/MicrosoftAjax.js"></script>
<script type="text/javascript" src="../../Scripts/MicrosoftMvcAjax.js"></script>
<script type="text/javascript">
function done() {
alert('done');
}
</script>
<script type="text/javascript">
<!--
var canvascheck = document.createElement('canvas');
if (canvascheck.getContext || (document.all && document.namespaces && !window.opera)) {
document.writeln('<style type="text/css">');
document.writeln('img.instant { visibility: hidden; }');
document.writeln('<\/style>');
}
-->
</script>
</head>
<body >
<center>
<div id="status">
<table width="750" cellspacing="0" cellpadding="10" rules="all" border="1" style="background-color:#EEEEEE;width:750px;border-collapse:collapse;">
<tr align="center">
<td width="187.5" valign="top">
<a id="picLinks_0" class="picLinks" href=''><img class="instant ishadow50" id='001' src="http://adam.kantro.net/pics/Jersey_Shore_1/Thumbnails/Jersey_Shore_1- pic001.jpg"></img></a>
<br/>
</td>
<td width="187.5" valign="top">
<a id="picLinks_1" class="picLinks" href=''><img class="instant ishadow50" id='002' src="http://adam.kantro.net/pics/Jersey_Shore_1/Thumbnails/Jersey_Shore_1-pic002.jpg"></img></a>
<br/>
</td>
<td width="187.5" valign="top">
<a id="picLinks_2" class="picLinks" href=''><img class="instant ishadow50" id='003' src="http://adam.kantro.net/pics/Jersey_Shore_1/Thumbnails/Jersey_Shore_1-pic003.jpg"></img></a>
<br/>
</td>
<td width="187.5" valign="top">
<a id="picLinks_3" class="picLinks" href=''><img class="instant ishadow50" id='004' src="http://adam.kantro.net/pics/Jersey_Shore_1/Thumbnails/Jersey_Shore_1-pic004.jpg"></img></a>
<br/>
</td>
</tr>
<tr align="center">
<td width="187.5" valign="top">
<a id="picLinks_4" class="picLinks" href=''><img class="instant ishadow50" id='005' src="http://adam.kantro.net/pics/Jersey_Shore_1/Thumbnails/Jersey_Shore_1-pic005.jpg"></img></a>
<br/>
</td>
<td width="187.5" valign="top">
<a id="picLinks_5" class="picLinks" href=''><img class="instant ishadow50" id='006' src="http://adam.kantro.net/pics/Jersey_Shore_1/Thumbnails/Jersey_Shore_1-pic006.jpg"></img></a>
<br/>
</td>
</tr>
</table>
</div>
<img id="updating" src="../../images/ajax-loader.gif" style="display: none;" alt="Updating ..." />
<br />
<div id="paging">
Page: 1 of 9 1
<a href="/Photos/Album?Page=2&AlbumName=Jersey_Shore_1" onclick="Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, loadingElementId: 'updating', updateTargetId: 'status', onSuccess: Function.createDelegate(this, done) });">2</a>
<a href="/Photos/Album?Page=3&AlbumName=Jersey_Shore_1" onclick="Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, loadingElementId: 'updating', updateTargetId: 'status', onSuccess: Function.createDelegate(this, done) });">3</a>
<a href="/Photos/Album?Page=4&AlbumName=Jersey_Shore_1" onclick="Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, loadingElementId: 'updating', updateTargetId: 'status', onSuccess: Function.createDelegate(this, done) });">4</a>
<a href="/Photos/Album?Page=5&AlbumName=Jersey_Shore_1" onclick="Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, loadingElementId: 'updating', updateTargetId: 'status', onSuccess: Function.createDelegate(this, done) });">5</a>
<a href="/Photos/Album?Page=6&AlbumName=Jersey_Shore_1" onclick="Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, loadingElementId: 'updating', updateTargetId: 'status', onSuccess: Function.createDelegate(this, done) });">6</a>
<a href="/Photos/Album?Page=7&AlbumName=Jersey_Shore_1" onclick="Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, loadingElementId: 'updating', updateTargetId: 'status', onSuccess: Function.createDelegate(this, done) });">7</a>
<a href="/Photos/Album?Page=8&AlbumName=Jersey_Shore_1" onclick="Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, loadingElementId: 'updating', updateTargetId: 'status', onSuccess: Function.createDelegate(this, done) });">8</a>
<a href="/Photos/Album?Page=9&AlbumName=Jersey_Shore_1" onclick="Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, loadingElementId: 'updating', updateTargetId: 'status', onSuccess: Function.createDelegate(this, done) });">9</a>
Next >>
</div>
</div>
</body>
</html>