ruby on rails - change image in partial from js.erb without refresh of page -


ruby ​​v 1.9.3p194 rails v 3.1.3

i have ruby ​​/ rail / js a while i Till no benefit was taken. How can I update both images with caption_photo?

I am using JS to capture an image from a webcam and I am setting it as an avatar of users. The pictures are being stored in the patient. Photo_ue

I display the image in part 2 and want both images to be saved once. I think I want to do it with my capture_photo.js.erb

  // related sidbar.html .ahl:% a # user_sidebar_image {href: "javascript: zero (0)" } = Image_tag user_avatar_url (current_change, "thumbs") // related_patient_info.html. Evening:% img.img-polaroid {: src = & gt; "# {Photo}", alt: "patient avatar image"} // relevant caption_photos Jesserb:  // I want to set a picture here  

OK ... the answer is. .

  & lt;% if @success == true% & gt; $ ('# User_sidebar_image' img ') Attr ('src', "and lt;% = @ patient.photo.try (: url)% & gt;") $ ('thumbnail-container & gt; img'). Attr ('src', 'and lt;% = @ patient.photo.try (: url)% & gt; ")  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -