我有这段代码:
import java.util.function.BiFunction;
import com.test.service.IService;
public class AddService implements IService {
@Override
public BiFunction<Integer, Integer, Integer> add = (x, y) -> {
return x + y;
};
}
这会向我的服务器发出一个帖子请求,就像我在我的应用程序中经常这样做一样。
Chrome会像这样显示此请求:
$.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!");
}
);
响应显示如下:
Request Method:POST
Status Code:200 OK
Remote Address:192.168.178.80:1414
所以Servers响应看起来像一个有效的JSON响应,而http代码是200个任何想法为什么成功处理程序不会触发?
答案 0 :(得分:5)
这是有效的JSON:
{"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}
但这不是:
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}
看起来服务器正在使用PHP,并且在打印JSON的语句之前有一个print_r
。