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

The Archive Base Latest Questions

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

I am new to Ajax and javqscript. I am returning My list with Image

  • 0

I am new to Ajax and javqscript.

I am returning My list with Image Path through Json. Could anyone tell me the way to display the Image?

I am loading data using Ajax call.

Ajax Call
var TableHeaderArray = ["Person", "Details"]; 
$.ajax({
url: '/Home/Persondetails',
type: 'POST',
dataType: "json", 
beforeSend: function () {
},
success: function (response) {
$('#Person').append(CreateHTMLTableFromJSON(response, "lightPro", TableHeaderArray)).fadeIn();
},
error: function (error) {
alert(error);
}
});

Controller

[HttpPost]
public ActionResult Persondetails()
{
SqlConnection con = new SqlConnection();
con.ConnectionString = ConfigurationManager.ConnectionStrings["PersonConnectionString"].ConnectionString;
con.Open();
SqlCommand cmd = new SqlCommand("GetDetails", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteScalar();
DataSet ds = new DataSet();
SqlDataAdapter sda = new SqlDataAdapter(cmd);
sda.Fill(ds);
List<Person> Details = new List<Person>();
foreach (DataRow dr in ds.Tables[0].Rows)
{
Details.Add(new Person()
{
Id = dr["Id"].ToString(),
Name = dr["Name"].ToString(),
Age = dr["Age"].ToString(),
Job = dr["Job"].ToString(),
images = dr["Images"].ToString(),
});
}
return Json(Details);
}
  • 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-12T00:55:12+00:00Added an answer on June 12, 2026 at 12:55 am

    For axample this way:

    $.ajax({
           url: 'some_url',
           success: function(data) {
              // Here will be image inserting
            }
      });
    

    Now we have 2 cases:

    1) This image(with for instance id = imagId) is already on your page. In this case in success callback you should do the following:

    $('#imgId').attr('src', data.imageUrl);
    

    2) You have to insert new image on page. So, in this case success callback will look like:

    var img = $('<img/>', {'src': data.imageUrl} );  
    $('#whereToInsertId').append(img);
    

    It should work;)

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

Sidebar

Related Questions

I'm trying to figure out how to load a new image with ajax when
I have a WCF service in an ASP.NET AJAX app that is returning json.
I've been using EXTJS 4 and loading my stores through an AJAX call to
My project is returning JSON to Ajax calls from the browser. I'm wondering what
So I'm new to json/ajax/jquery/webservices I am trying to do a join page whereby
I was looking for an elegant way to upload images AJAX style. I'm new
Hey there, new to AJAX, JS.. Im trying to add to a Javascript/Ajax search
I'm completely new to the javascript and ajax world but trying to learn. Right
Yo. I'm really quite new to this whole JavaScript business, not to mention AJAX,
Consider this code: new Ajax.Request('?service=example', { parameters : {tags : 'exceptions'}, onSuccess : this.dataReceived.bind(this)

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.