Jquery ajax NEVER passing data to php script

Jquery ajax NEVER passing data to php script

Hello,

It seems my code is NEVER passing data to my php script. I'm using xamp as "server"...

here is how I coded :

  1. $.ajax({
            url: "phpscript.php",
            type : 'POST',
          contentType: "application/json; charset=utf-8",
          data:{user_id:'user_id'},
          dataType : 'text',
           success: function(result){
           console.log(result);}});

My php is soooo simple

  1. <?php
    $value = array();
    $value['id'] = 'ok' . $_POST['user_id'];
    echo json_encode($value);
    ?>

console.log(result) says : 

  1. <br />
  2. <b>Notice</b>:  Undefined index: user_id in <b>D:\xampp\htdocs\myapp\phpscript.php</b> on line <b>9</b><br />
  3. {"id":"ok"}
just as if $.ajax was NEVER sending it "data" when calling the php script...

Any help fixing that !?  (ps : please don't tell me isset() or empty() because This code is suppose to be (or MUST) populating $_POST with data ....