Skip to main content
added 278 characters in body
Source Link
thecodeparadox
  • 87.2k
  • 22
  • 143
  • 164

Here I try to give you some idea.

Make associative array in PHP using key => value pair like

$data = array('id' => 1, 'quat' => 10, 'id' => 2, 'quat' => 20)

and then send it as json_encode() like

header('Content-type: application/json');  // don't miss it
echo json_encode(array('data' => $data));

In jQuery

$.post('edit/producomponentes.php',{id:id},function(response){
    //READ data HERE.
    console.log(response.data); // you will get a json Object
}, 'json');
     ^-------- set dataType as json, then you don't any extra parse effort

###According to edit

 $.post('edit/producomponentes.php',{id:id},function(data){
        $.each(data, function(index, value) {
           console.log(value.componente);
           console.log(value.quantidade);
        });
    }, 'json');

Here I try to give you some idea.

Make associative array in PHP using key => value pair like

$data = array('id' => 1, 'quat' => 10, 'id' => 2, 'quat' => 20)

and then send it as json_encode() like

header('Content-type: application/json');  // don't miss it
echo json_encode(array('data' => $data));

In jQuery

$.post('edit/producomponentes.php',{id:id},function(response){
    //READ data HERE.
    console.log(response.data); // you will get a json Object
}, 'json');
     ^-------- set dataType as json, then you don't any extra parse effort

Here I try to give you some idea.

Make associative array in PHP using key => value pair like

$data = array('id' => 1, 'quat' => 10, 'id' => 2, 'quat' => 20)

and then send it as json_encode() like

header('Content-type: application/json');  // don't miss it
echo json_encode(array('data' => $data));

In jQuery

$.post('edit/producomponentes.php',{id:id},function(response){
    //READ data HERE.
    console.log(response.data); // you will get a json Object
}, 'json');
     ^-------- set dataType as json, then you don't any extra parse effort

###According to edit

 $.post('edit/producomponentes.php',{id:id},function(data){
        $.each(data, function(index, value) {
           console.log(value.componente);
           console.log(value.quantidade);
        });
    }, 'json');
added 63 characters in body
Source Link
thecodeparadox
  • 87.2k
  • 22
  • 143
  • 164

Here I try to give you some idea.

Make associative array in PHP using key => value pair like

$data = array('id' => 1, 'quat' => 10, 'id' => 2, 'quat' => 20)

and then send it as json_encode() like

header('Content-type: application/json');  // don't miss it
echo json_encode(array('data' => $data));

In jQuery

$.post('edit/producomponentes.php',{id:id},function(response){
    //READ data HERE.
    console.log(response.data); // you will get a json Object
}, 'json');
     ^-------- set dataType as json, then you don't any extra parse effort

Here I try to give you some idea.

Make associative array in PHP using key => value pair like

$data = array('id' => 1, 'quat' => 10, 'id' => 2, 'quat' => 20)

and then send it as json_encode() like

echo json_encode(array('data' => $data));

In jQuery

$.post('edit/producomponentes.php',{id:id},function(response){
    //READ data HERE.
    console.log(response.data); // you will get a json Object
}, 'json');
     ^-------- set dataType as json, then you don't any extra parse effort

Here I try to give you some idea.

Make associative array in PHP using key => value pair like

$data = array('id' => 1, 'quat' => 10, 'id' => 2, 'quat' => 20)

and then send it as json_encode() like

header('Content-type: application/json');  // don't miss it
echo json_encode(array('data' => $data));

In jQuery

$.post('edit/producomponentes.php',{id:id},function(response){
    //READ data HERE.
    console.log(response.data); // you will get a json Object
}, 'json');
     ^-------- set dataType as json, then you don't any extra parse effort
added 71 characters in body
Source Link
thecodeparadox
  • 87.2k
  • 22
  • 143
  • 164

Here I try to give you some idea.

Make associative array in PHP using key => value pair like

$data = array('id' => 1, 'quat' => 10, 'id' => 2, 'quat' => 20)

and then send it as json_encode()json_encode() like

echo json_encode(array('data' => $data));
 

In jQuery

$.post('edit/producomponentes.php',{id:id},function(dataresponse){
    //READ data HERE.
    console.log(response.data); // you will get a json Object
}, 'json');
     ^-------- set dataType as json, then you don't any extra parse effort

Here I try to give you some idea.

Make associative array in PHP using key => value pair like

$data = array('id' => 1, 'quat' => 10, 'id' => 2, 'quat' => 20)

and then send it as json_encode() like

echo json_encode(array('data' => $data));
 
$.post('edit/producomponentes.php',{id:id},function(data){
    //READ data HERE.
    console.log(data);
}, 'json');
     ^-------- set dataType as json

Here I try to give you some idea.

Make associative array in PHP using key => value pair like

$data = array('id' => 1, 'quat' => 10, 'id' => 2, 'quat' => 20)

and then send it as json_encode() like

echo json_encode(array('data' => $data));

In jQuery

$.post('edit/producomponentes.php',{id:id},function(response){
    //READ data HERE.
    console.log(response.data); // you will get a json Object
}, 'json');
     ^-------- set dataType as json, then you don't any extra parse effort
Post Undeleted by thecodeparadox
Post Deleted by thecodeparadox
Source Link
thecodeparadox
  • 87.2k
  • 22
  • 143
  • 164
Loading