title: Ajax success and error function is not calling properly in jquery
body: <p>I have used postman to send the json data to the specifified url.I am getting the requred response that is json in postman.I want to send this json to some other file so i used ajax post method.Ajax post method is not called.My function is not triggering success or error here.</p>
  
  <pre><code> &lt;?php
  // get the HTTP method, path and body of the request
  $method = $_SERVER['REQUEST_METHOD'];
  $request = explode('/', trim($_SERVER['PATH_INFO'],'/'));
  $input = json_decode(file_get_contents('php://input'),true);
  $value1=json_encode($input);
  //echo print_r($value1,1);
  ?&gt;
  &lt;script type="text/javascript"&gt;
    $(document).ready(function() {
    //  alert("hello");
        var jsondata = &lt;?php echo $value1 ?&gt;;
        $.ajax({
          url: "/restapi/subscribe.php",
          type: "POST",
          data: { jsondata:jsondata },
          dataType: "json",
          Content-Type: "application/json",
          success: function() {
            alert("data sent!");
          },
          error: function() {
            alert("There was an error. Try again please!");
          }
        });
        return false;
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>I am sending any of the json data as input.Output also json data that should be posted in subscribe.php.In subscribe.php i have written </p>
  
  <pre><code>&lt;?php 
  $json=$_POST['jsondata'];
  echo $json;
  ?&gt;
  </code></pre>