title: Get data from php file + ajax
body: <p>i want to get data that's loaded in my PHP file in javascript.
  This is what I do:</p>
  
  <pre><code>$("#submit").click(function() {
      // GET VALUE OF APPID
      var appid = $("#appid").val()
      // GET JSON FROM PHP SCRIPT
      $.ajax({
          type: 'GET',
          url: '../loadjson.php',
          data: {
              'appid': appid
          },
          success: function (data) {
              alert('success');
          },
          error: function(jqXHR,error, errorThrown) {  
              if(jqXHR.status&amp;&amp;jqXHR.status==400){
                  alert(jqXHR.responseText); 
              }else{
                  alert("Something went wrong");
              }
          }
      });
  
  });
  </code></pre>
  
  <p>When I click a button I get the value of a textbox and call ajax function.
  my javascript file is located in root/js/file.js and my php file in root/loadjson.php</p>
  
  <p>My PHP file:</p>
  
  <pre><code>&lt;?php
  
  if(isset($_POST['appid']) &amp;&amp; !empty($_POST['appid'])) {
      $appid = $_POST['appid'];
  }
  $json_url  ='http://api.url.com/api/gateway/call/1.4/getApp?appid=' . $appid;
  
  $ch = curl_init($json_url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  
  $str = curl_exec($ch);
  curl_close($ch);
  
  $data = json_decode($str);
  
  $array = $data;
  $object = $array-&gt;app[0]; 
  
  echo $object;
  </code></pre>
  
  <p>?></p>
  
  <p>The problem is I get always an alert box with "Something went wrong" but I can't find the solution. Does someone see my fault?</p>
  
  <p>I get this:
  <img src="https://i.stack.imgur.com/IlP9Y.png" alt="enter image description here"></p>
  
  <p>jsfiddle: <a href="http://jsfiddle.net/wKe2U/" rel="nofollow noreferrer">http://jsfiddle.net/wKe2U/</a></p>