简体   繁体   English

Ajax请求在Cordova上获得500(内部服务器错误)

[英]Ajax request gets 500 (Internal Server Error) on cordova

I have an ajax request, when I make the request in the browser it works fine, when i make it inside cordova apk, I get internal error, I've look into both headers, the only diference is in the ORIGIN; 我有一个ajax请求,当我在浏览器中发出请求时,它运行良好,当我在cordova apk中发出请求时,出现内部错误,我查看了两个标头,唯一的区别在于ORIGIN;

This is the one not working, with origin:file:// 这是不起作用的,其来源为:file://

POST http://XXX:50000/RESTAdapter/s4p/mobile/login 500 (Internal Server Error) POST http:// XXX:50000 / RESTAdapter / s4p / mobile / login 500(内部服务器错误)

Accept:application/json, text/javascript, */*; q=0.01 Accept-Encoding:gzip, deflate Accept-Language:en-US Connection:keep-alive Content-Length:59 Content-Type:application/json Cookie:saplb_*=(J2EE9465620)9465650 Host:------- Origin:file:// User-Agent:Mozilla/5.0 (Linux; Android 7.0; Android SDK built for x86 Build/NYC; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/51.0.2704.90 Mobile Safari/537.36 X-DevTools-Emulate-Network-Conditions-Client-Id:364FC1A3-AE91-465B-821A-9EA13D731E5E X-Requested-With:io.cordova.hellocordova

Your AJAX request arrives to the server and you get an error there, on your server. 您的AJAX请求到达服务器,然后在服务器上收到错误。 Due to the error, the response is a 500 . 由于该错误,响应为500 If you know that this works in some cases and does not work in other cases, then check the differences between the different requests and see what is the stack trace of the error. 如果您知道这在某些情况下有效,而在其他情况下无效,那么请检查不同请求之间的差异,并查看错误的堆栈跟踪情况。 When you have done that, you will know what the problem is. 完成此操作后,您将知道问题出在哪里。 And from there on, you will be in an infinitely better position than now to fix the issue. 从现在开始,您将可以比现在拥有更好的位置来解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM