javascript - How to assign the newly created AWS URL to display the image? -


this ajax call being used generate url , upload image through server. need 6 urls 6 image upload , display them.

$.ajax({                 type: "get",                 url: "http://localhost:3000/users/get_url/13",                 success :(data) ->                     new_key = data[0].key                     processfile $user_id1,(result)->                         console.log data[0].url                         $user_id1 = datauritoblob(result)                         reader1 = new filereader()                         reader1.readasarraybuffer($user_id1)                         reader1.onload = (e) ->                             rawdata1 = reader1.result;                             $.ajax({                                  url: data[0].url,                                  type: 'put',                                 xhr: ->                                      myxhr = $.ajaxsettings.xhr();                                     if (myxhr.upload)                                         myxhr.upload.addeventlistener('progress', progresshandlingfunction, false);                                     return myxhr;                                 ,                                 success: completehandler,                                 error: errorhandler,                                 data: rawdata1,                                 cache: $.param(false),                                 contenttype: "binary/octet-stream",                                 processdata: $.param(false)                             }, 'json');             }) 

html code display image -

<input type="hidden" name="user_id2_key" value="<%= @aws_urls[0][:key] %>"/> <input id="file_upload2" type="file" accept="image/*" name="user_id2"/> 

above 1st image out of 6. how reuse other 5? when try change index value of url, throws error saying nil class!


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

php - Cannot override Laravel Spark authentication with own implementation -

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -