Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1111947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:37:48+00:00 2026-05-17T02:37:48+00:00

I have a form in jQuery where I update all the images via a

  • 0

I have a form in jQuery where I update all the images via a simple ajax call to reload the entire page. Unfortunately the captions are included in that form as well, and as I start writing, my captions are overwritten.

What then would you do to keep them?

Would you..

  1. Save them before the ajax call and replace them after it?

  2. Avoid updating the captions all together?

The latter seems like the best choice, I’m just not entirely sure how I would implement calling an AJAX call but just updating the images .

My sweet updater

$.extend({
  PhotoUpdater: {
    startUpdate: function(organization, gallery){
      url = "/organizations/" + organization + "/media/galleries/" + gallery + "/edit_photo_captions"
      timer = window.setTimeout(function(){
       $.PhotoUpdater.doUpdate(url)
      }, 5000) 
    },
    stopUpdate: function(){
      clearTimeout(timer);
      timer = 0;
    },
    doUpdate: function(url){
      $.ajax({type: "GET", url: url, dataType: "script"});
    },
    resetValues: function(){
      setTimeout(function(){ $("body").data("edit_photos_closed", "false"); 
                             $.PhotoUpdater.stopUpdate();
      }, 3000 );
    }
  }
});

my html

<div class="alpha grid_4 zebraCaption">
      <img src="/tumblr_l0x861Yc5M1qbxc42o1_400.jpg" id="thumb_216" alt="Trippy Long Stockings's amazing picture">
      <br>
      <label for="gallery_photos_attributes_0_caption">Caption</label>
      <br>
      <input type="text" style="width: 236px;" size="35" name="gallery[photos_attributes][0]" maxlength="35" id="gallery_photos_attributes_0_caption">
      <br>
      <a class="button_small facebox_window" href="/organizations/1/media/galleries/26/photos/216/edit_facebox_captions?captions_screen=true">edit crop</a>
      <a id="remove_crop_216" class="button_small remove_crop_button" href="http://localhost:3000/photos/216/toggle_crop">remove crop</a>
  </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:37:49+00:00Added an answer on May 17, 2026 at 2:37 am

    You could try something like this:

    If you have 10 images on the page then the AJAX response could be a JSON array of 10 img sources. You can then do:

    var imgArray = {JSON ARRAY FROM AJAX}
    $('img').each(function(index){
        $(this).attr('src',imgArray[index]);
    });
    

    This would only work if you know the order of the images on the page, though, or they are identified by IDs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: jQuery AJAX submit form I have a form on a page A,
I have a simple form created using Ajax.BeginForm : <% using (Ajax.BeginForm(Update, Description, new
I have a JQuery/Ajax update. It correctly updates in all major browsers, however, dealing
I have a form which I call via AJAX (for use on a CMS)
I have a form what jQuery sents for me using Ajax to php. For
I have a simple login form and have jQuery validate replacing the field labels
So I have ajax file upload partial (using Jquery Form plugin), it's working perfectly,
I have a jQuery ajax script to process a form on submit. However, I
I have a form on a webpage that I submit using the jquery form
I have a form in a jQuery popup on a webpage. The jQuery popup

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.