我正在尝试获取src
加载后已添加到页面的图像的属性,但结果不断返回undefined
。
$('#qtr').change(function() {
data = {
'img': $('#edit_image').attr('src'),
'degrees': '90'
};
$.post('/ajax/ajax_images/rotate', data, function(response) {
if (response.error != 0) {
alert('Unable to rotate image');
}
else {
$('#edit_image').attr('src', response.html);
new_image = response.html;
var start = new_image.lastIndexOf('/') + 1;
new_image = new_image.substr(start);
}
}, 'json');
});
$('#edit_image')
是新创建的图像。我哪里错了?