Made working principle more error prone and allowed for error recovery using JS/JSON
This commit is contained in:
parent
a30e5d76a1
commit
7f019dd740
@ -53,7 +53,7 @@ class ClubsControllerParts extends BaseController
|
||||
|
||||
$user->setName($name);
|
||||
$user->save();
|
||||
$this->setRedirect('index.php?option=com_clubs&view=mypage&layout=parts&type=name');
|
||||
return 'index.php?option=com_clubs&view=mypage&layout=parts&type=name';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,10 +21,19 @@ jQuery(function($){
|
||||
ev.preventDefault();
|
||||
var form = $(this).parent();
|
||||
$.post(form.attr('action'), form.serializeArray(), function(d){
|
||||
form.replaceWith(d);
|
||||
if(d.success) {
|
||||
$.get(d.data, function(d2){
|
||||
form.replaceWith(d2);
|
||||
});
|
||||
} else {
|
||||
alert(d.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$(document).on('submit', 'form.clubs-part', function(ev){
|
||||
ev.preventDefault();
|
||||
$('a.clubs-save', this).click();
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ $user = $auth->getCurrentUser();
|
||||
|
||||
if($mode === 'edit')
|
||||
{
|
||||
echo "<form method='POST' action='index.php?option=com_clubs&task=parts.edit&format=json'>";
|
||||
echo "<form method='POST' action='index.php?option=com_clubs&task=parts.edit&format=json' class='clubs-part'>";
|
||||
|
||||
switch($type)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user