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

  • Home
  • SEARCH
  • 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 8190067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:29:46+00:00 2026-06-07T03:29:46+00:00

I have a problem with jquery and serialize method. I have a form, that

  • 0

I have a problem with jquery and serialize method.

I have a form, that I send via $.ajax method. In this method I use serialize();. Before I call serialize I use a function that modifies the 2 input text values, but on serialize the 2 inputs send the old values.

This is my code.

$('#formANAGRAFICA3').submit(function() { 
    codeAddress();
    var $form = $('#formANAGRAFICA3'); 
    $.ajax({
        type: 'post',
        data : $form.serialize(),
        url: $form.attr( 'action' ),
        success: function(data, textStatus, jqXHR) {
            $('#editANAGRAFICA3').show();
        }
    });
    return false;
});

function codeAddress() { 
    var address = 'my value';
    geocoder.geocode( {'address': address}, function(results, status) { 
        if (status == google.maps.GeocoderStatus.OK) { 
            var pos = results[0].geometry.location;
            map.setCenter(pos);
            marker.setPosition(pos);
            document.getElementById("aTitle33").value = pos.lat(); 
            document.getElementById("aTitle34").value = pos.lng();
        } else {
            alert("Geocode was not successful for the following reason: " + status);
        }
    });
} 

When it send the form, the data received is not updated, even though I modified the input text values with the codeAddress function. Why?

  • 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-06-07T03:29:49+00:00Added an answer on June 7, 2026 at 3:29 am

    codeAddress() does not modify your input fields instantly. Instead, it issues an AJAX (asynchronous) request, and updates your inputs when the response comes in. In the meantime, the rest of your code proceeds as normal.

    As a timeline:

    1. Call codeAddress()
    2. Issue AJAX request to Google maps
    3. Return from codeAddress()
    4. Serialize and submit form
    5. Response from Google comes back.
    6. Inputs are modified, too late to be used in the form submit.

    The solution is to wait for geocoder.geocode() to complete before submitting the form.

    geocoder.geocode( { 'address': address}, function(results, status) {
        // Modify inputs
        // Submit form
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that is being serialized by JQuery and posted via .ajax()
I have this line: $.post('/update', $('form').serialize(), function(){alert(hello)}); The problem is the alert is not
I have a form I wish to submit via ajax usind the jQuery $.post
I have a form that submits a jQuery .ajax event every time menu's value
I have the following AJAX function with JQuery: var formData = $('#FonykerEditForm').serialize(); $.ajax ({
I have the following Jquery Ajax call that upon completion changes the HTML of
I have a problem with Jquery function getJSON, the action url does not trigger
I have a little problem with Jquery getJSON function. my json here { entries:
I have an Action Method that returns a JSON-serialized object. The problem I'm having
I have the following problem: I have a form I need to serialize but

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.