1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-04 10:19:25 +02:00

Fix dynamic page form submit when form action is javascript

This commit is contained in:
Afterster 2015-06-05 07:28:03 +02:00
parent 5f06a444ed
commit d930718c8f
2 changed files with 19 additions and 17 deletions

View file

@ -92,23 +92,25 @@ $(function() {
var postData = $(this).serializeArray(); var postData = $(this).serializeArray();
var formURL = $(this).attr("action"); var formURL = $(this).attr("action");
$.ajax( if (formURL.indexOf('javascript:') !== 0) {
{ $.ajax(
url : formURL, {
type: "POST", url : formURL,
data : postData, type: "POST",
success:function(data, status, jqXHR) data : postData,
{ success:function(data, status, jqXHR)
loadContentData(data, status, jqXHR); {
window.location.hash = ""; loadContentData(data, status, jqXHR);
}, window.location.hash = "";
error: function(jqXHR, status, errorThrown) },
{ error: function(jqXHR, status, errorThrown)
alert(errorThrown); {
} alert(errorThrown);
}); }
});
e.preventDefault(); e.preventDefault();
}
} }
}); });

View file

@ -30,7 +30,7 @@ if (!Core::is_session_started()) {
<h4><?php echo T_('Filters'); ?></h4> <h4><?php echo T_('Filters'); ?></h4>
<div class="sb3"> <div class="sb3">
<?php if (in_array('starts_with',$allowed_filters)) { ?> <?php if (in_array('starts_with',$allowed_filters)) { ?>
<form id="multi_alpha_filter_form" method="post" action="javascript:void(0);"> <form id="multi_alpha_filter_form" action="javascript:void(0);">
<label id="multi_alpha_filterLabel" for="multi_alpha_filter"><?php echo T_('Starts With'); ?></label> <label id="multi_alpha_filterLabel" for="multi_alpha_filter"><?php echo T_('Starts With'); ?></label>
<input type="text" id="multi_alpha_filter" name="multi_alpha_filter" value="<?php $browse->set_catalog($_SESSION['catalog']); echo scrub_out($browse->get_filter('starts_with'));?>" onKeyUp="delayRun(this, '400', 'ajaxState', '<?php echo Ajax::url('?page=browse&action=browse&browse_id=' . $browse->id . '&key=starts_with'); ?>', 'multi_alpha_filter');"> <input type="text" id="multi_alpha_filter" name="multi_alpha_filter" value="<?php $browse->set_catalog($_SESSION['catalog']); echo scrub_out($browse->get_filter('starts_with'));?>" onKeyUp="delayRun(this, '400', 'ajaxState', '<?php echo Ajax::url('?page=browse&action=browse&browse_id=' . $browse->id . '&key=starts_with'); ?>', 'multi_alpha_filter');">
</form> </form>