Created
August 30, 2014 12:48
-
-
Save Ulv/d6b76193b2123915a40e to your computer and use it in GitHub Desktop.
ajax load joomla rsform
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
### | |
# ajax подгрузка части формы | |
### | |
$.fn.extend | |
bestdiplomAjaxForm: (options) -> | |
@defaultOptions = | |
### основной селект, объект jQuery ### | |
primarySelect: $('#second') | |
loadTo: $('#ajaxload') | |
settings = $.extend({}, @defaultOptions, options) | |
return @each () -> | |
settings.primarySelect.change(-> | |
if $(@).val() == 'Аттестат 9 класса' or $(@).val() == 'Аттестат 11 класса' | |
if !window.loaded | |
window.origform = settings.loadTo.clone(true) | |
url = "/?option=com_rsform&view=rsform&formId=5&tmpl=component .formContainer" | |
settings.loadTo.load(url, -> | |
window.loaded = true | |
settings.loadTo.find("input[type=text], input[type=password], select").styler() | |
$('#Submit').on "click",-> | |
submitFastorderForm(settings.primarySelect.parentsUntil('form').parent()) | |
return | |
) | |
else | |
if window.loaded | |
settings.loadTo.html('').append(window.origform) | |
window.loaded = false | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment