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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:53:38+00:00 2026-05-31T22:53:38+00:00

i try to send my datas to php with ajax but there’s strange mistake.

  • 0

i try to send my datas to php with ajax but there’s strange mistake.

this is my ajax script,

function deleteData2()
{
    var artistIds = new Array();

    $(".p16 input:checked").each(function(){
        artistIds.push($(this).attr('id'));
    });


$.post('/json/crewonly/deleteDataAjax2', 
       { json: JSON.stringify({'artistIds': artistIds}) },
       function(response){
        alert(response);
});


}

i think this works correctly but in php side, i face 500 internal server error(500).

public function deleteDataAjax2() {

            $json = $_POST['json'];
            $data = json_decode($json);
            $artistIds = $data['artistIds'];

              $this->sendJSONResponse($artistIds);
    }

Above code is my php. For example, when i try to send $data to ajax,
i print my ids in json mode:

enter image description here

However, when i try to send $artistIds to ajax side, i gives 500 error why?

  • 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-31T22:53:39+00:00Added an answer on May 31, 2026 at 10:53 pm

    Selam 🙂

    Right should be:

    public function deleteDataAjax2() {
        $json = $_POST['json'];
        $data = json_decode($json, true);
        $artistIds = $data['artistIds'];
    
        $this->sendJSONResponse($artistIds);
    }
    

    look at json_decode(). If you wanna use this as an array, you have to set the second parameter to true, otherwise use $data->{'artistIds'}; 🙂

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

Sidebar

Related Questions

When I use this code, it works: ajax.open(post,a.php,true); but when I try to send
i try to send some data to my php file from ajax , but
i try to send data to my php scripts but i think i miss
I try to send json array to ajax (from PHP to jQuery) in my
I'm using Jquery, Ajax and PHP to try and send a variable to be
I try to send data form ajax to cakephp cotroller function loadtooltip(obj, $user_id) {
function ajaxFunction(phpFunction){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera
I try to send a request to my server via GET, but qooxdoo sends
I try to send a sms using next code, but recipient gets my message
I am using Ajax POST method to send data, but i am not able

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.