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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:49:26+00:00 2026-05-24T12:49:26+00:00

I got this in my html : <script src=http://code.jquery.com/jquery-1.6.2.min.js></script> <script> $.post(mm.php, { func: getNameAndTime

  • 0

I got this in my html :

<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>

<script>
$.post("mm.php", { func: "getNameAndTime" },
  function(data){
    $(data).each(function() {
    $("div").append($(this).name);
    });
  }, "json");
</script>

<div></div>

And my mm.php looks like this :

<?php echo json_encode(array("my" => array("name"=>"John","time"=>"2pm"), "ur"=>array("name"=>"Nah","time"=>"1:13")) ); ?>

This was working before i putted the .each() so doesnt have the including or other problems.

Why isnt this working ?
Where have i been going wrong ?

  • 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-24T12:49:27+00:00Added an answer on May 24, 2026 at 12:49 pm

    data is not a DOM element, it’s a JSON object. You need to use $.each instead of .each() Also, inside the each(), this is an object, not a DOM element, so you don’t need $() around it.

    $.each(data, function() {
       $("div").append(this.name);
    });
    

    EDIT: Instead of using this inside the each try this:

    $.each(data, function(i,v) {
       $("div").append(v.name);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got HTML code that roughly looks like this: <li id=someid-11> <img src=... alt=alt
I've got the following in my <head> section: <script type=text/javascript> $(function(){ $(h5).live(click, function(){ alert($(this).tmplItem());
I got this bad feeling about how I insert larger amounts of HTML. Lets
I got a problem like this (this is html/css menu): Eshop | Another eshop
In javascript, I've got a block of HTML like this: <h2>{title}</h2> <p><a href={url}>{content}</a></p> And
I got this script off 9lessons.info and it is supposed to auto suggest friends
I have a Jquery Script which is depenedent on this Script Sort.js . Can
I refer to this question: Javascript value to PHP with Jquery I tried with
<html lang=en> <head> <meta http-equiv=Content-Type content=text/html; charset=UTF-8 /> <title>Sort plugin for jQuery</title> </head> <body>
I got this error today when trying to open a Visual Studio 2008 project

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.