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 1017163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:39:42+00:00 2026-05-16T10:39:42+00:00

I have the following code where the function codeaddress geocodes the text feild value

  • 0

I have the following code where the function codeaddress geocodes the text feild value and returns geocoded value , geocoded value is stored in variable example ,how will i return the variable v2 to the function call and post to asmx webservice.

<script type="text/javascript">
    $(document).ready(function() {
        $('#SubmitForm').submit(function() {


  var geocoder;
  var map;
   function codeAddress(state) {
    var address = document.getElementById("state").value;
    geocoder.geocode( { 'address': state}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        map.setCenter(results[0].geometry.location);
        var v2=results[0].geometry.location;
        alert(example);
        var marker = new google.maps.Marker({
            map: map, 
            position: results[0].geometry.location
        });
      } else {
        alert("Geocode was not successful for the following reason: " + status);
      }
      return v2;
    });


            var businessname = ($("#businessname").val());
            var keyword = ($("#keyword").val());
            var description = ($("#textarea").val());
            var zipcode = ($("#zipcode").val());
            var streetno = ($("#streetno").val());
            var streetname = ($("#streetname").val());
            var state = $('#state :selected').text();
            var telephone = ($("#telephone").val());
            var email = ($("#email").val());
            var username = ($("#username").val());
            var password = ($("#pass").val());
            var repassword = ($("#pass1").val());


            //data: "{'businessname':" + businessname + "'keyword':" + keyword + "}",

            alert(state); 
           var v2=codeAddress(state);
            alert(example);
            var jsonobject = "{\"businessname\":\"" + businessname + "\",\"keyword\":\"" + keyword + "\",\"description\":\"" + description + "\",\"zipcode\":\"" + zipcode + "\",\"streetno\":\"" + streetno + "\",\"streetname\":\"" + streetname + "\",\"state\":\"" + state + "\",\"telephone\":\"" + telephone + "\",\"email\":\"" + email + "\",\"username\":\"" + username + "\",\"password\":\"" + password + "\",\"repassword\":\"" + repassword + "\"}";
            $.ajax({
                type: "POST",
                url: "/BlockSeek/jsonwebservice.asmx/SubmitList",
                data: jsonobject,
                contentType: "application/json; charset=utf-8",
                success: ajaxCallSucceed,
                dataType: "json",
                failure: ajaxCallFailed
            });
        });

        function ajaxCallFailed(error) {
            alert("error");
        }

        function ajaxCallSucceed(response) {
            if (response.d == true) {
                alert(" sucessfully saved to database");
            }
            else {
                alert("not saved to database");
            }
        }




    });
</script>
  • 1 1 Answer
  • 3 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-16T10:39:43+00:00Added an answer on May 16, 2026 at 10:39 am

    You call the codeAddress method with a callback. Inside codeAddress when you get value of v2, call the callback function passing it v2.

    codeAddress(state, 
        function(v2) {
            var jsonobject = "{\"businessname\":\"" + businessname/*.. use v2 in buiding jsonobject..*/;
            $.ajax({
                type: "POST",
                url: "/BlockSeek/jsonwebservice.asmx/SubmitList",
                data: jsonobject,
                contentType: "application/json; charset=utf-8",
                success: ajaxCallSucceed,
                dataType: "json",
                failure: ajaxCallFailed
            });
        }
    );
    
    function codeAddress(state, callback) {
        var address = document.getElementById("state").value;
        geocoder.geocode(...);
        // ...
        var v2=results[0].geometry.location;
        callback(v2);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: Function TruncateString(str, n) ' Returns an array with strings
For example I have the following code: function a($param) { function b() { echo
I have following code in JavaScript function checkEntries() { if(document.getElementById(username)== && document.getElementById(password).value==) { alert(Please
I have the following code: function isValidAuthor($authorID){ $query = SELECT * FROM jos_users WHERE
I have the following code: function build_all_combinations(input_array){ array = [1,2,3] limit = array.length -
I have the following code: function Person(){ this.age = 30; } function Stats(){ this.age
I have the following code function generate_pdf() { $fdf_data_strings = $this->get_hash_for_pdf(); #$fdf_data_names = array('49a'
I have the following code: function toggleChecked(status) { $(.checkbox).each( function() { $(this).attr(checked,status); }) }
I have the following code: function show(){ var a=document.getElementById('somediv').style.display; a=block; } The above code
Suppose I have the following code function myFunction(param, callback) { ... if (err) {

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.