I'm breaking down my problem of trying to upload an image via Ajax to Python.
Step 1: Just get the Ajax to display the selected image on the page.
I found this interesting article on Zurb which seems to have the example code I need: http://zurb.com/playground/ajax-upload
$(document).ready(function() {
var thumb = $('img#thumb');
new AjaxUpload('imageUpload', {
action: $('form#newHotnessForm').attr('action'),
name: 'image',
onSubmit: function(file, extension) {
$('div.preview').addClass('loading');
},
onComplete: function(file, response) {
thumb.load(function(){
$('div.preview').removeClass('loading');
thumb.unbind();
});
thumb.attr('src', response);
}
});
I'm implemented the plugin and setup things up, however the response that gets set to the src is the HTML page itself, rather then the image.
I'm noticing a similar problem on Zurb's website when I check what the src path of the thumb image is after uploading.
Also duplicated in my jsfiddle here: http://jsfiddle.net/leongaban/cd5Hy/1/
Can you see where am I going wrong?