Created
July 7, 2011 00:53
-
-
Save mcrider/1068697 to your computer and use it in GitHub Desktop.
hack to reload a grid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{** | |
* urlInDiv.tpl | |
* | |
* Copyright (c) 2000-2011 John Willinsky | |
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING. | |
* | |
* Generate JS and HTML to include a URL in a DIV, AJAX-style. | |
* | |
*} | |
<div id="{$inDivDivId}"{if $inDivClass} class="{$inDivClass}"{/if}>{$inDivLoadMessage}</div> | |
<a href="#" id="reload_{$inDivDivId}">Reload this bad boy</a> | |
<script type='text/javascript'> | |
$(function() {ldelim} | |
function loadDiv() {ldelim} | |
$.getJSON("{$inDivUrl|escape:"javascript"}", function(jsonData) {ldelim} | |
if (jsonData.status === true) {ldelim} | |
$("#{$inDivDivId}").hide().html(jsonData.content).fadeIn(400); | |
{rdelim} else {ldelim} | |
// Alert that loading failed | |
alert(jsonData.content); | |
{rdelim} | |
{rdelim}); | |
{rdelim} | |
$("#reload_{$inDivDivId}").click(function() {ldelim} | |
loadDiv(); | |
return false; | |
{rdelim}); | |
loadDiv(); | |
{rdelim}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment