Created
May 6, 2016 22:15
-
-
Save crimx/c8f7af69af92bf4951f9386c4dc6cded to your computer and use it in GitHub Desktop.
mofun avatar
This file contains hidden or 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
$("#user_photo_upload").upload("/index.php?act=upload&mdl=upload&is_temp=1", function(ret) { | |
var ret_url = ret.url.replace('/', '\/'); | |
if (ret.status === 'ok') { | |
$.ajax({ | |
type: 'POST', | |
url: "/index.php?act=ajax&mdl=user_photo&func=user_photo_save", | |
data: { | |
"photo": { | |
"240x240_f": ret.filename, | |
"240x240_url": ret_url, | |
"180x180_f": ret.filename, | |
"180x180_url": ret_url, | |
"130x130_f": ret.filename, | |
"130x130_url": ret_url, | |
"80x80_f": ret.filename, | |
"80x80_url": ret_url, | |
"50x50_f": ret.filename, | |
"50x50_url": ret_url, | |
"30x30_f": ret.filename, | |
"30x30_url": ret_url | |
} | |
}, | |
success: function(ret) { | |
if (ret.status == 'ok') { | |
$.dialog.tips("新头像设置成功。", 2, "succeed").position("50%", "50%").lock(); | |
setTimeout(function(){location.href=$.url.attr("source");}, 1000); | |
} else { | |
$.dialog.tips(ret.status, 2, "error").position("50%", "50%").lock(); | |
} | |
}, | |
error: function(XMLHttpRequest, textStatus, errorThrown) { | |
errmsg = ajaxerrmsg(XMLHttpRequest, textStatus); | |
$.dialog.tips(errmsg, 2, "error").position("50%", "50%").lock(); | |
}, | |
complete: function(XMLHttpRequest, textStatus) {}, | |
dataType: "json" | |
}); | |
} else { | |
console.log('error'); | |
} | |
}, 'json'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment