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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:12:18+00:00 2026-06-11T02:12:18+00:00

i want jquery to take a JsonResult from my MVC controller but it does’nt

  • 0

i want jquery to take a JsonResult from my MVC controller but it does’nt receive any data!

If I put the output into a textfile and enter its link its working so I think my jQuery is fine.

Then I was testing with other browsers like chrome and I saw NOTHING. The requested page was just emtpy.. no errors. Also IE seems to have problems receiving my string.. only firefox displays the string but why?

    public JsonResult jsonLastRequests()
    {
        List<Request> requests = new List<Request>();
        while (r.Read())
        {
            requests.Add(new Models.Request()
            {
                ID = (int)r[0],
                SiteID = r[1].ToString(),
                Lat = r[2].ToString(),
                City = r[4].ToString(),
                CreationTime = (DateTime)r[5]
            });
        }
        r.Close();
        return Json(requests);
    }

I found out that also if I want to return the JSON as string its not working!
Its working with a string in all browsers now.. but jQuery is still not loading anything

        var url = "http://../jsonLastRequests";
        var source =
        {
            datatype: "json",
            datafields: [
                { name: 'ID' },
                { name: 'SiteID' },
                { name: 'Lat' },
                { name: 'CreationTime' },
                { name: 'City' },
            ],
            id: 'id',
            url: url
        };
        var dataAdapter = new $.jqx.dataAdapter(source, {
            downloadComplete: function (data, status, xhr) { },
            loadComplete: function (data) { },
            loadError: function (xhr, status, error) { }
        });

I fixed my problem by adding:
access-control-allow-origin:*

  • 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-11T02:12:19+00:00Added an answer on June 11, 2026 at 2:12 am
     public HtmlString jsonLastRequests()
        {
            List<Request> requests = new List<Request>();
            while (r.Read())
            {
                requests.Add(new Models.Request()
                {
                    ID = (int)r[0],
                    SiteID = r[1].ToString(),
                    Lat = r[2].ToString(),
                    City = r[4].ToString(),
                    CreationTime = (DateTime)r[5]
                });
            }  r.Close();
     System.Web.Script.Serialization.JavaScriptSerializer jSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
    
    
                return new HtmlString(jSerializer.Serialize(requests ));}
    

    I have done same approch like this

      $.ajax({
            type: 'POST',
            url: '/home/GetSurvey',
            data: {
                XmlPath: $("#xmlpath").val()
            },
            dataType: 'json',
            success: function (jsonData) {
                jsonStringQuestionaire = jsonData;
                LoadSurvey();
            },
            error: function () {
                alert('Error loading ' + id);
            }
        });
     questionaireJsonList = eval(jsonStringQuestionaire);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jQuery to take data from an xml file and save it
I want to take an icon from the jQuery Themeroller and implement it as
I want use JQuery mobile for the front-end of my mobile application, but I
I want to use jQuery to pull information from my database when I click
I want to take advantage of some jquery functions for sending messages like having
I want to take the current value indicator off the jquery mobile slider. How
When the page loads, I want to use Javascript/Jquery to automatically take the user
i want to take an array and cut some of the keys from it
I want to take my JQuery Accordion and, with it starting open on the
I want change background picture(a div) with javascript that I will take from database.

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.