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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:00:47+00:00 2026-05-27T10:00:47+00:00

I am getting a JSON object in my javascript function in aspx page. I

  • 0

I am getting a JSON object in my javascript function in aspx page. I need to fetch this data from my code behind file. How can I do it?

My javascript function is :

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

            var requestParameter = '{' +
                        'output:"' + results + '"}';

            $.ajax({
                type: "POST",
                url: "Default.aspx/GetData",
                data: requestParameter,
                //contentType: "plain/text",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function(msg) {
                    alert(msg.d);

                }, 
                error: function() { alert("error"); } 
            });

        });
    }


   Default.aspx.cs

 [WebMethod]
public static string  GetData( Object   output) 
{
    return output.ToString();
}

I am getting the output as an array of objects instead of the actual result – [object Object],[object Object],[object Object] .Please provide me a solution to get the actual result. The JSON I am working on is given below
http://maps.googleapis.com/maps/api/geocode/json?address=M%20G%20Road&sensor=false

  • 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-27T10:00:48+00:00Added an answer on May 27, 2026 at 10:00 am

    Create a WebMethod on your aspx Page that get the array on the page as:

    [WebMethod]
    public static GetData( type[] arr)  // type could be "string myarr" or int type arrary - check this
    {}
    

    and make json request.

    $.ajax({
      type: 'POST',
      url: 'Default.aspx/GetData',
      data: "{'backerEntries':" + backerEntries.toString() + "}",
      contentType: 'application/json; charset=utf-8',
      dataType: 'json',
      success: function(response) {}
    });
    

    or you can use .post().

    Check the url: in ajax request GetData WebMethod must be declared on the Default.aspx on that page where you are making ajax request.

    Check this question to know that how to format array for sending to the web method.
    Why doesn't jquery turn my array into a json string before sending to asp.net web method?

    Check these links for reference:
    Handling JSON Arrays returned from ASP.NET Web Services with jQuery – It is Best to take idea
    How to post an array of complex objects with JSON, jQuery to ASP.NET MVC Controller?

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

Sidebar

Related Questions

I'm getting this json string info from the server : {members:[[sd2840d,Johny],[jkld341,Marry]]} So I store
I am getting a JSON object from a webMethod by the call below and
I'm having problems trying to call a Javascript function from an enqueued javascript file
I am using Jquery for getting a json object from a solr server. When
Getting Json from the Server and displaying it in the grid is relatively straight
I am getting JSON response from the server..Inside that JSON string i am having
I'm having a little dilemma with an iphone project. I'm getting some JSON data
im getting response in json, but this wont parse the json response. what m
I am facing issue with the following Json reponse object in the javascript eval
I'm getting JSON-encoded output from another organization's API. In many cases, the output can

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.