Skip to content

Instantly share code, notes, and snippets.

@gdakram
Created May 17, 2010 15:54
Show Gist options
  • Save gdakram/403902 to your computer and use it in GitHub Desktop.
Save gdakram/403902 to your computer and use it in GitHub Desktop.
$j(document).ready(function(){
if (window.location.href.match(/avatarSelect/)) {
var $submit_button = $j("<input type='submit' value='Update My Avatar'/>");
$j("input[name=btnSubmit]:first").replaceWith($submit_button);
$j("form").bind("submit",function(){ return false; });
$submit_button.bind("click", function(){
var $form = $j(this).closest("form");
$form.find("input[name=cmd]").val("avatarUpdate");
$j.ajax({
url : $form.attr("action"),
type : "POST",
data : $form.serialize(),
success : function(){
window.location.href = "/main/homearea/info.pl";
}
});
})
}
});
@gdakram
Copy link
Author

gdakram commented May 17, 2010

After successfully submitting an ajax request to update the avatar, you are then redirected to the qpod.
Change "/main/homearea/info.pl" on line 13 to whatever address you would like to redirect to.

Examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment