Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php jQuery Ajax Json回调问题_Php_Jquery_Json_Ajax_Jquery Callback - Fatal编程技术网

Php jQuery Ajax Json回调问题

Php jQuery Ajax Json回调问题,php,jquery,json,ajax,jquery-callback,Php,Jquery,Json,Ajax,Jquery Callback,我正在开发一个移动应用程序,试图通过jQueryAjax将数据从应用程序发送到API。即使我定义了回调,它仍不断给我一个回调错误 下面的代码是连接到API的jQueryAjax function isDashboard(){ var task = 'balance'; var json = { // Create object "task" : task, "merchant" : getSession('x_u'), "token" :

我正在开发一个移动应用程序,试图通过jQueryAjax将数据从应用程序发送到API。即使我定义了回调,它仍不断给我一个回调错误

下面的代码是连接到API的jQueryAjax

function isDashboard(){
   var task = 'balance';
   var json = { // Create object
       "task" : task,
       "merchant" : getSession('x_u'), 
       "token" : getSession('x_token')
   };
   var jsonfull = []; // Push to jsonfull.
   jsonfull.push(json);
   var url = JSON.stringify(json);
   var crypt = CryptoJS.SHA512(getSession('x_token')+task+getSession('x_email')+url).toString(CryptoJS.enc.Hex);
   $.ajax({
       url: "http://samplesite.com/?p=app&'", 
       crossDomain: true,
       data: {
           json : url,
           hash :crypt
       },
       dataType: "jsonp"
   })
   .done(function (json){ 

       $('#welcome').prepend(json.response);
       alert(json.response);

   })
   .fail(function (jqxhr, textStatus, error){
       var err = textStatus + ", " + error;
       $('#welcome').prepend(err);

   });

}
在我的php接收文件中,我有

$rest = $_GET['json'];
$api = json_decode($rest,true);
$type = "json";
// did some processing with $api
//returning response to the app
$out = [];    
$out['response'] = 'X006';
$out['description'] = 'Invalid hash';
$out['values'] = '';
$out['salt'] = $salt;
$out['hash'] = '';
if($type == 'json'){
    header('Content-Type: text/json');
    $out = $_GET['callback'].'('.json_encode($out).')';
}
echo $out;      
die();
我不断得到错误解析器错误,错误:jquery111036580699938349426_1446328908674未被调用


我很感激能得到的任何帮助。关于

我看不到你呼出$out,例如,
echo$out-您确定收到响应吗?@jpaljasma question edited.error parser error-是在服务器端还是客户端(浏览器端)?尝试确定错误发生在哪一行?你在访问日志中看到请求了吗?请解释一下,你是想说错误在php代码中的某个地方吗?请简化你的解释@我正试图排除所有可能的选择。桌上剩下的就是答案。