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

  • Home
  • SEARCH
  • 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 6324753
In Process

The Archive Base Latest Questions

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

In php i created an array named : $errorsa = array(); Then for each

  • 0

In php i created an array named :

$errorsa = array();

Then for each error i add it something values in array by something like this :

$errorsa[] = array("id"=>"rules","error"=>"You need to agree to rules");

Then at the end of the file i do this :

echo json_encode($errorsa);

Then in my main file i do something like this :

$("#submiter").click(function() {
    $.post("submit.php",
        $("#formmain").serialize(),
        function(data) {
            $.each(data,function() {
                $("#result").append(this.error);
            });
        },
        "json"
    )
});

But this aint working ?
I am new to json and looking forward on it.
What have i dont wrong in this ?

  • 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-24T16:45:53+00:00Added an answer on May 24, 2026 at 4:45 pm

    try something like this:

    php:

    <?php
    $errorsa = array();
    $errorsa[] = array("id"=>"rules","error"=>"You need to agree to rules");
    echo json_encode($errorsa);
    ?>
    

    JS:

    $("#submiter").click(function() {
            $.post("submit.php", function(data) { $.each(data,function(){alert(this.error)}) },'json')
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need some php help in figuring out how use this array I created, but
I created the following interface: <?php interface Action { public function execute(\requests\Request $request, array
I have a time stamp I created with PHP that I would like to
I'm trying to follow the instructions here: http://www.php.net/manual/en/features.commandline.usage.php I created a file named vardump
I have this code: <?php ini_set('display_errors', true); error_reporting(E_ALL); include ../../../wp-load.php; $groups = array(); if
echo $this->Form->create('Comment', array('url'=>array('controller' => 'comments', 'action' =>'add', $listposts['Post']['id']) ) ); echo $this->Form->input('post_id',array('type'=>'hidden','style'=>'width:30%','value'=>$listposts['Post']['id'])); echo $this->Form->input('name',array('style'=>'width:30%'));
I can create a sparse php array (or map) using the command: $myarray =
I have created a PHP-script to update a web server that is live inside
I have created a PHP script and I am lacking to extract the primary
I just created a PHP page that spits outs some data from my 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.