小编use*_*675的帖子

在这种情况下,为什么jquery不调用成功处理程序?

我有这个代码:

$.post( "/ankauf/", {
        "kunden_id" : 1,
        "products" : products,
        "full_price" : parseInt($('#totalPrice').text()),
        "_token" : $('meta[name="csrf-token"]').attr('content')
    },
    function( data ) {            
        toastr.success("Ankauf abgeschlossen", "OK!");
    }
);
Run Code Online (Sandbox Code Playgroud)

这会向我的服务器发出一个帖子请求,就像我在我的应用程序中经常这样做.

Chrome会像这样显示此请求:

Request Method:POST  
Status Code:200 OK  
Remote Address:192.168.178.80:1414  
Run Code Online (Sandbox Code Playgroud)

响应如下所示:

Cache-Control:no-cache  
Connection:close  
Content-Type:application/json

Response content:  
array(7) {  
  ["product_id"]=>  
  string(1) "5"  
  ["paidprice"]=>  
  string(2) "85"  
  ["condition"]=>  
  string(8) "Sehr Gut"  
  ["ovp1"]=>  
  string(1) "0"  
  ["ovp2"]=>  
  string(1) "0"  
  ["ovp3"]=>  
  string(1) "0"  
  ["ovp4"]=>  
  string(1) "0"  
}  
{"full_price":"85","updated_at":"2016-06-27 14:01:55","created_at":"2016-06-27 14:01:55","id":73,"created_by_id":1,"customer_id":1}
Run Code Online (Sandbox Code Playgroud)

所以Servers响应看起来像一个有效的JSON响应,http代码是200任何想法为什么成功处理程序不会触发?

javascript jquery post json

0
推荐指数
1
解决办法
41
查看次数

标签 统计

javascript ×1

jquery ×1

json ×1

post ×1