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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:49:20+00:00 2026-05-31T20:49:20+00:00

i try to send data to my php scripts but i think i miss

  • 0

i try to send data to my php scripts but i think i miss something.

First of all,

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

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


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


    }

Above code is my js file. i have artistIds in var artistIds. My goal is sending this array to my php script.In order to that, i make it json , i mean encode it with JSON.stringify

then in php side, i use below code.However, $array is always null. What might be the reason ?

public function deleteDataAjax2() {

        $array=json_decode($_POST['artistIds']);

        if (isset($array))
            $this->sendJSONResponse('ok');

    }
  • 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-31T20:49:21+00:00Added an answer on May 31, 2026 at 8:49 pm

    You are passing the data as a raw string of JSON, but your PHP is trying to find that string by parsing the data as application/x-www-form-urlencoded and then looking at the artistIds key.

    Assuming the array is flat: Forget JSON. You don’t need it.

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

    And:

    $array = $_POST['artistIds'];
    

    If the array isn’t flat, then:

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

    And (with suitable error checking added):

    $json = $_POST['json'];
    $data = json_decode($json);
    $artists = $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
Im getting a connection refused when I try to send some data to my
I try to send a request to my server via GET, but qooxdoo sends
I try to use PHPMailer to send registration, activation. etc mail to users: require(class.phpmailer.php);
I had try to implement the send me log feature into my apps but
I'm using Jquery, Ajax and PHP to try and send a variable to be
I am trying to send data to my PHP script to handle some stuff
I try to send a mail via php to an yahoo recipient. Every time
I try to send json array to ajax (from PHP to jQuery) in my
I try to send gps longitude and latitude to the android emulator with eclipse,

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.