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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:46:55+00:00 2026-05-14T06:46:55+00:00

Im having a bit of trouble getting my JSON to be recognised by my

  • 0

Im having a bit of trouble getting my JSON to be recognised by my web page. I have validated JSON that im getting returned from server, so i know that is correct, however my javascript function is not doing anything with it. My succes function is as follows:

success: function(data) {
  $('input[name=customer_name]').val(data.name);
  $('textarea[name=customer_address]').text(data.address);
  $('input[name=customer_email]').val(data.email);
  $('input[name=customer_tel]').val(data.tel);
  $('input[name=user_id]').val(item.id);
}

Yet the fields are not being repopulated with the data that is returned, if it helps, a sample of my JSON data:

{
    "name": "Terry O'Toole",
    "address": "Terrys House\nTerry Street\nTerrysville\nTerrytown\nTT1 6TT",
    "email": "teryy@two.com",
    "tel": "05110000000"
}

Any help would be appreciated.

[EDIT]

Expanded ajax call:

$.ajax({
  url: "<?php echo site_url('user/users/ajax'); ?>",
  type: 'POST',
  data: {"userid": item.id},
  success: function(data) {
    $('input[name=customer_name]').val(data.name);
    $('textarea[name=customer_address]').text(data.address);
    $('input[name=customer_email]').val(data.email);
    $('input[name=customer_tel]').val(data.tel);
    $('input[name=user_id]').val(item.id);
  }
 })
});
  • 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-14T06:46:56+00:00Added an answer on May 14, 2026 at 6:46 am

    I take it you’re using jQuery (from the val function you’re using). Are you specifying the dataType parameter to $.ajax? E.g.:

    $.ajax({
        url: "blah",
        dataType: "json",
        success: ...
    });
    

    If not, it may not be guessing correctly (perhaps you’re not sending back the right content type?) and you’ll have to use JSON.parse on it. But best to A) Set the correct content type on the response, and B) use dataType to express your intent in the code.

    Edit Just saw your edit. Definitely try adding dataType.

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

Sidebar

Related Questions

I'm having a bit of trouble getting my program to read in data from
Having a bit of trouble getting this right... The main objective is to have
I'm having trouble getting this bit of JSON into a POJO. I'm using Jackson
I am having quite a bit of trouble getting mini_magick to draw text that
I'm having a bit of trouble getting the desired functionality from my function... Basically,
I've been having quite a bit of trouble getting an MVC2 web application to
I'm having a bit of trouble getting the right results from a query. At
I'm having a bit of trouble getting my form validation to work. As of
I'm having a bit of trouble getting my app to show up in the
I'm currently working with PowerPoint in VB.NET and having a bit of trouble getting

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.