Created
February 21, 2011 13:06
-
-
Save butaji/837036 to your computer and use it in GitHub Desktop.
This file contains 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
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> | |
Поиск по узлу | |
</asp:Content> | |
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> | |
<script type="text/javascript"> | |
function loadFormWithHash() { | |
$.get('<%= Url.Action("SearchForm","Person") %>?' + window.location.hash.slice(1), | |
function (data) { | |
$('#searchContainer').html(data); | |
} | |
); | |
} | |
function loadResultsWithHash() { | |
$.get('<%= Url.Action("SearchResults","Person") %>?' + window.location.hash.slice(1), | |
function (data) { | |
$('#searchResults').html(data); | |
} | |
); | |
} | |
$(function () { | |
if (window.location.hash) { | |
loadFormWithHash(); | |
loadResultsWithHash(); | |
} else { | |
$.get('<%= Url.Action("SearchForm","Person", ViewData.Model) %>', | |
function (data) { | |
$('#searchContainer').html(data); | |
} | |
); | |
$.get('<%= Url.Action("SearchResults","Person", ViewData.Model) %>', | |
function (data) { | |
$('#searchResults').html(data); | |
} | |
); | |
} | |
$('#searchContainer>form').live("submit", function () { | |
$('#searchResults').html("Загрузка..."); | |
var parameters = $(this).serialize(); | |
window.location.hash = parameters; | |
loadResultsWithHash(); | |
return false; | |
}); | |
}); | |
</script> | |
<h2> | |
Форма поиска</h2> | |
<div id="searchContainer"> | |
Загрузка... | |
</div> | |
<h2> | |
Форма результатов поиска</h2> | |
<div id="searchResults"> | |
Загрузка... | |
</div> | |
</asp:Content> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment